Page 28 of 32

Re: PurePDF Version 2.0

Posted: Mon Mar 24, 2014 9:29 pm
by ABBKlaus
I can only add a check in ipdf_putbookmarks() and it will break iteration if it finds an invalid level.
You can check with pdf_geterrorcode() after pdf_save() for the errorcode 19 alias #PDF_ERROR_BOOKMARK.
I have uploaded a new version, same link as above.

BR Klaus

Re: PurePDF Version 2.0

Posted: Thu Mar 27, 2014 5:02 pm
by normeus
I added the following if test at the end of "ipdf_PutBookMarks()" procedure

Code: Select all

 
   ;OutLine root
    ipdf_NewObj()
    pdfOutlineRoot = ipdf_GetN()
    ipdf_Out("<</Type /Outlines /First " + Str(ln) + " 0 R")
    If (SelectElement(lru(),0)) ; just in case there was a problem
      ipdf_Out("/Last " + Str(ln + lru()) + " 0 R>>")
    Else
      ipdf_Out("/Last " + Str(ln) + " 0 R>>")
      pdfError=#PDF_ERROR_BOOKMARK
    EndIf
    ipdf_Out("endobj")
  EndIf
EndProcedure 

Re: PurePDF Version 2.0

Posted: Thu Mar 27, 2014 9:11 pm
by ABBKlaus
Thanks normeus,

fix is added. Tailbiten libs can be (re)downloaded from my page.

BR Klaus

Re: PurePDF Version 2.0

Posted: Thu Jul 17, 2014 1:24 pm
by Tranquil
At first I want to thank all who improved this great lib!

Using this lib leads me to two questions:

1st: Is there a way to avoid including complete Fonts in the PDF File? If I export an PDF File from out of MS-Word, these fonts will not be included.
2nd: If i create a printer object (for eg with PB internal printer lib or the external Printer_Lib include), is it possible to print it to PDF?

Thank you very much!!

I get this error ..

Posted: Sun Sep 14, 2014 1:13 pm
by VisualJump3D
Hi ,



I tried this example: <<Tutorial 01 Hello Word.pb>>

I get this error in purePDF.pb :

<<Line 5584:Invalide name:same as a command ( from library PurePDF ) >>

Can you help me, please ?

Thank

Re: PurePDF Version 2.0

Posted: Sun Sep 14, 2014 1:40 pm
by IdeasVacuum
Take a look at Line 5584 in PurePDF.pb and you should see the cause of the problem - a rename of the command with a prefix or postfix ought to fix it.

Re: PurePDF Version 2.0

Posted: Sun Sep 14, 2014 1:44 pm
by VisualJump3D
?????

Re: PurePDF Version 2.0

Posted: Mon Sep 15, 2014 7:08 am
by VisualJump3D
<<Take a look at Line 5584 in PurePDF.pb and you should see the cause of the problem - a rename of the command with a prefix or postfix ought to fix it.>>

I did it but it does not work ...


can someone help me?

( please )

Re: PurePDF Version 2.0

Posted: Mon Sep 15, 2014 8:33 am
by c4s
@VisualJump3D
Seems like you have the library installed (in compiler folder "\PureLibraries\UserLibraries\" and "\Residents\"). The problem is that the example tries to include the include file too. So all PurePDF commands would be declared twice which doesn't work.
I think IdeasVacuum's comment doesn't help here. Instead you should completely remove the library and just use the include file wherever you need it. That way you can also fix and enhance PurePDF yourself e.g. if something doesn't work as you want it to.

Re: PurePDF Version 2.0

Posted: Mon Sep 15, 2014 8:37 am
by VisualJump3D
Thank !

Re: PurePDF Version 2.0

Posted: Mon Sep 15, 2014 10:42 am
by IdeasVacuum
I think IdeasVacuum's comment doesn't help here.
I think that's true, sorry VisualJump3D. However, using the files as an include instead of installing the lib can still be a challenge, so unless you need to modify the files, it might be easier to just use the lib. That said, the lib might not be available for the PB version you are using, I think it ran into a TailBite issue.

Re: PurePDF Version 2.0

Posted: Mon Sep 15, 2014 10:54 am
by VisualJump3D
Thanks! Problem solved!

Re: PurePDF Version 2.0

Posted: Wed Sep 17, 2014 5:54 am
by Franky
Thanks for the great work, this is really helpfull to me.

Was this bug already mentioned?

Code: Select all

#PurePDF_Include=1
XIncludeFile "PurePDF.pb"

Procedure Footer()
  pdf_SetY(-15)
  pdf_SetFont("Arial","I",8)
  pdf_Cell(0,10,"Page "+Str(pdf_GetPageNo())+"/{nb}",0,0,#PDF_ALIGN_CENTER)
EndProcedure

Define file$="Tutorial02 Header-Footer.pdf"
Define i

pdf_Create()
pdf_SetProcFooter(@Footer())
pdf_AliasNbPages();
pdf_AddPage();
pdf_SetFont("Times","",12);
For i = 1 To 40
  pdf_AddPage();
  pdf_Cell(0,10,"Printing line number "+Str(i),0,1);
Next
pdf_Save(file$)
RunProgram(file$)
Enable Unicode, than take a look at the Page numbering!


Sorry, I didn't run through the 28 pages, and read all posts :lol:


Best regards

Franky

Re: PurePDF Version 2.0

Posted: Wed Sep 17, 2014 1:25 pm
by Franky
Hi there,
another small issue:

http://www.purebasicpower.de/downloads/ ... tSize.html

The help says, pdf_GetFontSize() returns the size in points. Actually it returns the size in mm (or the current format?)

Re: PurePDF Version 2.0 - unicode

Posted: Mon Oct 20, 2014 6:42 pm
by normeus
This Procedure replaces "{nb}" (aSource.s) with "41" ( aDest.s) or the number of final pages; in memory storage aData.MEM_DataStructure
it is the only time it is used by PurePDF.
it is a count backwards one byte at a time routine, however; in unicode it would be 2 bytes at a time.
I don't know if the rest of purepdf is unicode ready but for the problem of total page numbers loosing a byte fixing this routine would fix it.
I don't have the time to fix it now but since the routine is pretty generic I figure anyone even if not familiar with purepdf would come up with a clever way of replacing FOR loops with WHILE loops and using StringByteLength(aSource.s) as a STEP for the loops
Thanks in advance
Norm.

Code: Select all

Procedure MEM_DataReplace(*aData.MEM_DataStructure, aSource.s, aDest.s)
  Protected vSourceLen,vDestLen,vCurSize,vMaxSize,vCount,vFind,*tmp,vReturn,i,j
  
  vSourceLen   = Len(aSource)
  vDestLen     = Len(aDest)
  vCurSize     = *aData\lCursize  
  vMaxSize     = *aData\lMaxsize  
  vFind        = 0
  vReturn      = #True
  
  If (vDestLen > vSourceLen)
    For i = vCurSize To 0 Step -1
      vCount= 0
      For j = 1 To vSourceLen
        If PeekB(*aData\pData + i - vSourceLen + j - 1) = Asc(Mid(aSource,j,1))
          vCount = vCount + 1
        EndIf
      Next 
      If vCount = vSourceLen   
         vFind = vFind + 1   
      EndIf
    Next
    If (vFind > 0)
      vReturn = MEM_DataInit(*aData, vMaxSize + (vFind*(vDestLen - vSourceLen))) ; = #False
    EndIf  
  EndIf
  
  If vReturn = #True
    *tmp = AllocateMemory((vDestLen + vCurSize) - vSourceLen)
    If *tmp
      For i = vCurSize To 0 Step -1
        vCount= 0
        For j = 1 To vSourceLen
          If PeekB(*aData\pData + i - vSourceLen + j - 1) = Asc(Mid(aSource,j,1))
            vCount = vCount + 1
          EndIf
        Next
        If vCount = vSourceLen
          CopyMemory(*aData\pData + i, *tmp, *aData\lCurSize - i)
          CopyMemory(@aDest, *aData\pData + i - vSourceLen , vDestLen)
          CopyMemory(*tmp, *aData\pData + i - vSourceLen + vDestLen, *aData\lCurSize - i)
          *aData\lCurSize = *aData\lCurSize + (vDestLen-vSourceLen)
        EndIf
      Next
      FreeMemory(*tmp)
    Else
      vReturn = #False
    EndIf
  EndIf
  ProcedureReturn vReturn
EndProcedure