Page 31 of 32

Re: PurePDF Version 2.0

Posted: Sat Oct 15, 2016 9:27 pm
by normeus
This is what happens after you save so this will clear the PDF buffer and footer.
The title and other global variables
will still be there ( stuff that you set like pdf_SetAuthor(),pdf_SetTitle(),ETC... )

Code: Select all

ipdf_Close()
  If pdfBuffer\pData
    FreeMemory(pdfBuffer\pData)
  EndIf
  pdfBuffer\pData=0

Norm.

Re: PurePDF Version 2.0

Posted: Sun Oct 16, 2016 11:43 am
by Lord
Hi Norm.!

Thanks Norm.! Your snipped works.

But now I stumbled over the next hurdle.
It has to do with bookmarks.
When I create a PDf document twice, the first copy
will have bookmarks, the second has none. Everything
else looks ok.

It makes no difference wether
- I create the first document save this and creating
the second and save that
or
- interrupting the creation of the first document and
create this document again and save it.

Always the bookmarks are missing on second run.

When debugging, I can see that pdf_BookMark(msg)
is always called and msg has always the correct text.

What can be the reason for this?

Here is the example showing this result. I took the last
test code and put the pdf-creation in an procedure
and call this procedure twice:

Code: Select all

;Unicode example
;===============
#PurePDF_Include=1

XIncludeFile "\purepdf\Examples\PurePDF.pb" ; <-------- REPLACE THIS FILES LOCATION


CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Linux
    #ZLIB_IMPORT_PATH = #PB_Compiler_Home + "purelibraries/linux/libraries/zlib.a"
  CompilerCase #PB_OS_Windows
    #ZLIB_IMPORT_PATH = "zlib.lib"
  CompilerCase #PB_OS_MacOS
    #ZLIB_IMPORT_PATH = "/usr/lib/libz.dylib"
CompilerEndSelect

ImportC #ZLIB_IMPORT_PATH
  compress.l(*dest, *destlen, *source, sourcelen)
EndImport

Procedure.l PDFCompress(*aData.MEM_DataStructure)
  Protected zerr,CompMem,SourceLen,SourceMem,CompLen,lbError
 
  lbError = #False
  SourceLen = *aData\lCurSize
  SourceMem = *aData\pData
  CompLen   = (Int(SourceLen/8000)+1)*8000 + 16
  CompMem=AllocateMemory(CompLen)
  If CompMem
    zerr=compress(CompMem,@CompLen,SourceMem,SourceLen)
    If zerr = 0
      *aData\pData = CompMem
      *aData\lMaxSize = CompLen
      *aData\lCurSize = CompLen
      ;FreeMemory(Sourcemem) ; <- Crash with enabled purifier if run as TailBiten library
      lbError = #True
    EndIf
  EndIf
  ProcedureReturn lbError
EndProcedure

Procedure Footer()
  pdf_SetY(-15);
  pdf_SetFont("MS SansSerif","I",8);
  pdf_Cell(0,10,"Page "+Str(pdf_GetPageNo())+"/"+Chr(14),0,0,#PDF_ALIGN_CENTER);
EndProcedure


Procedure makePDF(run)
Protected File$
Protected String$,StringWidth.d,i
Protected CreateBookmarks=#True

File$=GetFilePart(#PB_Compiler_File)
File$=Mid(File$,1,Len(File$)-Len(GetExtensionPart(File$))-1)

pdf_Create()
pdf_SetProcFooter(@Footer())
pdf_AliasNbPages(Chr(14)); you need this to match your Footer procedure currently chr(16)
pdf_SetAuthor("PurePDF")
pdf_SetTitle(File$)
pdf_SetSubject("Unicode Text")
pdf_SetCreator("PurePDF")
pdf_SetKeywords(StringField(File$,1," "))
; pdf_SetProcCompression(@PDFCompress())
pdf_AddPage()
pdf_SetFont("Lucida Sans Unicode","",28)
pdf_Text(20,30,"PU??PЃ is ????")
pdf_BookMark("Page 1a")
pdf_Text(20,50,"??¤????????")
pdf_Text(20,70,Chr($107)+Chr($108)+Chr($109)+Chr($10A)+Chr($10B)+Chr($10C)+Chr($10D))
pdf_SetFont("Lucida Sans Unicode","",28)

For i=1 To 15
  pdf_AddPage()
   If CreateBookmarks
    pdf_BookMark("Page "+Str(i+1))
  EndIf
  pdf_Text(20,30,"PU??PЃ is ????")
  pdf_Text(20,50,"??¤????????")
  pdf_Text(20,70,Chr($107)+Chr($108)+Chr($109)+Chr($10A)+Chr($10B)+Chr($10C)+Chr($10D))
  pdf_text(20, 90, "Counter i="+Str(i))
Next

file$=Str(run)
pdf_Save(File$+".pdf")
RunProgram(File$+".pdf")
EndProcedure

makepdf(1)
makepdf(2)

Re: PurePDF Version 2.0

Posted: Sun Oct 16, 2016 2:26 pm
by normeus
That answer is on the help file:

Code: Select all

pdf_ResetBookMark()
by the way, I have made some useful changes to bookmarks all you have to do is copy the code if you go back a couple of page from this thread. Use google search which easily finds stuff in the forum:

https://www.google.com/advanced_search? ... rebasic.fr


Norm.

Re: PurePDF Version 2.0

Posted: Sun Oct 16, 2016 3:42 pm
by Lord
Hi Norm.!
normeus wrote:That answer is on the help file:

Code: Select all

pdf_ResetBookMark()
...
Stupid me. I could have found it by myself. :oops:

I will soon test your other changes soon.

Have a nice sunday!

Lord

Re: PurePDF Version 2.0

Posted: Sun Feb 19, 2017 8:33 pm
by normeus
There is an error with pdf_multicell() when it tries to do a line break and it is the first word it adds 1 character to the next line.
to fix this you have to go inside "Procedure.s ipdf_MultiCell()" and add a line.
around line 4759 add a line to see if this is the first word for the multicell line break:

Code: Select all

        saveX = pdfX
        If (first=#True And indent > 0)
          ipdf_SetX(pdfX + indent) 
          first = #False 
        EndIf             
        ipdf_Cell(w,h,Mid(s,j,i-j),b,2,align$,fill)      
        If j = 0: i + 1:EndIf ;>> If the first word is too long start on next character      
      Else 
        If(align$="J")
the only code you need to add is:

Code: Select all

 If j = 0: i + 1:EndIf ;
I included the other lines so you guys can see the context of the change.

@oakvalley ,@DoubleDutch
I just got a free trial of Adobe Acrobat DC and I see the error that shows when you look at properties of PDF
to fix this ( which is not an error Adobe should know it has to go to page 1 ) you do have to change "Procedure ipdf_PutCatalog()" just like @oakvalley said but what you have to change is the object that is being pointed to:
This is around line 2783 and the 1 should be changed to 3:

Code: Select all

  Select pdfZoomMode
    Case #PDF_ZOOM_FULLPAGE
      ipdf_Out("/OpenAction [3 0 R /Fit]")
    Case #PDF_ZOOM_FULLWIDTH
      ipdf_Out("/OpenAction [3 0 R /FitH null]")
    Case #PDF_ZOOM_REAL
      ipdf_Out("/OpenAction [3 0 R /XYZ null null 1]")
    Case #PDF_ZOOM_FULLSCREEN    ; <-- luis
      ipdf_Out("/PageMode/FullScreen")  ; <-- luis
    Default:
      ipdf_Out("/OpenAction [3 0 R /XYZ null null " + ipdf_StrF(pdfZoomMode/100,2) +  "]")
  EndSelect 
I tried with bookmarks and it worked fine so let me know if this does not work for you.

Norm.

Re: PurePDF Version 2.0

Posted: Sun Feb 19, 2017 9:02 pm
by IdeasVacuum
Valuable info, thanks normeus 8)

Re: PurePDF Version 2.0

Posted: Mon Feb 20, 2017 12:39 pm
by Hadrianus
I guess there is no more maintenance from the creator of this nice library. Pity.

Re: PurePDF Version 2.0

Posted: Mon Feb 20, 2017 5:24 pm
by IdeasVacuum
Since it is open source, that really doesn't matter, it can be modified as necessary.

Re: PurePDF Version 2.0

Posted: Wed May 17, 2017 8:22 am
by dige
Here is a new fix (thx to ABBKlaus), if you use .otf fonts and have problems with pdf_text()
You have to add [..] "Or version = $4F54544F"

Code: Select all

[846]  If version = $10000 Or version = $4F54544F ; 0x00010000 for version 1.0 / can be 'true' or 'typ1' on Apple Systems

Code: Select all

Procedure.i ipdf_TTF_SearchTagName(*TTF_Memory.TTF_Header,TagName.s)
  Protected version,numTables,searchRange,entrySelector,rangeShift
  Protected *OffsetTable.TTF_Header_Table
  Protected tag.s,checkSum.l,offset.l,Tlength.l
  
  If *TTF_Memory
    version       = ipdf_EndianL(*TTF_Memory\sfnt_version)
    numTables     = ipdf_EndianW(*TTF_Memory\numTables)
    searchRange   = ipdf_EndianW(*TTF_Memory\searchRange)
    entrySelector = ipdf_EndianW(*TTF_Memory\entrySelector)
    rangeShift    = ipdf_EndianW(*TTF_Memory\rangeShift)
    If version = $10000 Or version = $4F54544F ; 0x00010000 for version 1.0 / can be 'true' or 'typ1' on Apple Systems


Re: PurePDF Version 2.0

Posted: Tue Jun 13, 2017 1:54 pm
by dige
Hi there,

does someone knows, how to define the pdf background color?

Ciao dige

Re: PurePDF Version 2.0

Posted: Fri Jun 16, 2017 9:24 am
by dige
Use a background image now. That works for me.

But I have noticed that PurePDF can not handle 32 bit images...

Re: PurePDF Version 2.0

Posted: Thu Aug 24, 2017 4:29 am
by leodh
Hi all,

I am trying to get PurePDF (PurePDF225_PB52X86) working with PB5-43LTS (Windows - x86), has anyone been able to get it working.

I get the following error Invalid name: same as a command (from library "puePDF").

This is the procedure it first falls at

Code: Select all

Procedure.l pdf_AcceptPageBreak() ;Accept automatic page break or not
    ProcedureReturn ipdf_AcceptPageBreak()
  EndProcedure
Is there a quick fix for this error.

Cheers
Leo

__________________________________________________
BBCode enabled
24.08.2017
RSBasic

Re: PurePDF Version 2.0

Posted: Fri Aug 25, 2017 7:39 am
by dige
Looks like you've installed the libs and uses the include. I would recommend using only the include and delete the libs.

Re: PurePDF Version 2.0

Posted: Fri Sep 29, 2017 6:42 am
by quasiperfect
is the site down ?

can anyone share the latest version of the libs ?

Re: PurePDF Version 2.0

Posted: Fri Sep 29, 2017 8:02 am
by RSBasic
Look here and search for "PurePDF": http://www.rsbasic.de/backups/