Page 9 of 32
Posted: Wed Oct 22, 2008 6:28 pm
by Thorsten1867
Great! Perhaps we can create a new command like "pdf_SaveEmbedFiles(PdfFile$, ToPath$)"

Posted: Wed Oct 22, 2008 9:42 pm
by Marco2007
@ABBKlaus: I guess, it will be a long road to 4.30 final. Will you also release an updated version for 4.20? I guess no...
Posted: Fri Oct 24, 2008 3:29 pm
by ABBKlaus
Marco2007 wrote:@ABBKlaus: I guess, it will be a long road to 4.30 final. Will you also release an updated version for 4.20? I guess no...
Yes, here are the BETA links to PurePDF v2.14 :
PB4.20
http://www.purebasicpower.de/downloads/ ... 4_PB42.zip
PB4.30X86 (BETA4)
http://www.purebasicpower.de/downloads/ ... B43X86.zip
Changes :
- fixed pdf_Link() when orientation was landscape
- fixed ASCII85_Encode()
- added ASCII85_Decode()
Posted: Fri Oct 24, 2008 5:04 pm
by Marco2007
Thank you very much!

Posted: Wed Oct 29, 2008 12:53 pm
by luis
ABBKlaus,
is possible to build a PDF composed by pages of different sizes (each page a different size I mean) ?
Using pdf_Create([Orientation$ [, Unit$ [, Format$]]])
you define a format (A4 for example) for all the pages in the PDF.
Is it possibile to create each page of a custom size ? Standard PDF documents support this.
The idea would be create a pdf composed by pre-scanned images, not all exactly the same size, so I would need to set the size for any page, avoiding the white border caused by a common larger paper format.
I tried to look into the source to make an hack, but with no true luck at the moment.
Thank you.
Posted: Wed Oct 29, 2008 9:10 pm
by ABBKlaus
@luis,
could you try "Tutorial28 PageFormat.pb" and check if it fits your needs.
As always you have to download the BETA of PurePDF here :
http://www.purebasicpower.de/downloads/ ... B43X86.zip
Klaus
Posted: Wed Oct 29, 2008 10:36 pm
by luis
ABBKlaus wrote:@luis,
could you try "Tutorial28 PageFormat.pb" and check if it fits your needs.
Klaus
Klaus, seems perfect so far, thank you so much!
I used a macro to generate a "custom" format string to pass to the new pdf_AddPage() using the width / height of the current image !
I was fiddling with "/MediaBox" too and I realized I needed to store the data for each page, as you did with the new PagesF() list if I understood correcly, but I wasn't sure about where to put what.
By the way, I needed a new startup mode for the pdf at the opening: full screen.
So I added a couple of lines in my version:
Code: Select all
#PDF_ZOOM_FULLPAGE = 1
#PDF_ZOOM_FULLWIDTH = 2
#PDF_ZOOM_REAL = 3
#PDF_ZOOM_FULLSCREEN = 4 ; <-- luis
and this in ipf_PutCatalog()
Code: Select all
Select pdfZoomMode
Case #PDF_ZOOM_FULLSCREEN ; <-- luis
ipf_Out("/PageMode/FullScreen") ; <-- luis
Case #PDF_ZOOM_FULLPAGE
ipf_Out("/OpenAction [3 0 R /Fit]")
Case #PDF_ZOOM_FULLWIDTH
ipf_Out("/OpenAction [3 0 R /FitH null]")
Case #PDF_ZOOM_REAL
ipf_Out("/OpenAction [3 0 R /XYZ null null 1]")
Default:
If you found the above code ok, maybe you too can add this in the next version ?
Thank you again for your quick help

Posted: Sat Nov 01, 2008 9:50 pm
by ABBKlaus
thanks luis,
your code is in the latest version now.
http://www.purebasicpower.de/downloads/ ... B43X86.zip
Changes so far :
- added louis code
- added pdf_SetALaunch()
- added pdf_SetAText()
Klaus
Posted: Sun Nov 02, 2008 4:17 pm
by luis
Hi Klaus, I think there is a problem when adding an image with pdf_image() and the image format of the file is PNG (works ok with JPG).
It seems there is a memory leakage.
Try to run the following program in the "\Examples\PurePDF" (after expanding the zip archive above).
You need to put a suitable BMP image in the same dir, the program will generate the needed PNG files for the test.
I would use a quite big image to easily spot the problem.
I used a 1024x1204 texture in BMP format.
See the comments in the code for further info.
Code: Select all
IncludeFile ".\source\PurePDF_res.pb"
IncludeFile ".\source\PurePDF.pb"
Procedure Main()
Protected sTempFile.s
Protected nCurrImage, k
UsePNGImageEncoder()
CallDebugger ; start monitor the exe in task manager
pdf_Init()
pdf_Create4("L", "mm", #PDF_PAGE_FORMAT_A4)
ipf_SetDisplayMode(#PDF_ZOOM_FULLPAGE, #PDF_LAYOUT_SINGLE)
; use a big enough bmp to easily spot leakage, I used a 1024x1024
nCurrImage = LoadImage(#PB_Any, "test_png_leak.bmp")
For k = 1 To 50
sTempFile = "out" + Str(k) + ".jpg" ; save with a new name every time
SaveImage(nCurrImage, sTempFile, #PB_ImagePlugin_PNG) ; save as png
pdf_AddPage()
; add the png file, ipf_ParseImage() is called
pdf_Image3(sTempFile,0,0,0,297) ; fit A4
DeleteFile(sTempFile)
Next
FreeImage(nCurrImage)
pdf_Save("test_png_leak.pdf")
pdf_End()
CallDebugger ; now you should see around 50% of the memory still allocated
EndProcedure
Main()
The leakage goes away if you add a FreeMemory() in ipf_ParseImage(FileName$) :
Code: Select all
;Check if PNG
;============
If vReturn = #False
If (PeekB(vData\pData) & $FF)=137 And (PeekB(vData\pData+1) & $FF)=80 And (PeekB(vData\pData+2) & $FF)=78 And (PeekB(vData\pData + 3) & $FF)=71 And (PeekB(vData\pData+4) & $FF)=13 And (PeekB(vData\pData+5) & $FF)=10 And (PeekB(vData\pData + 6) & $FF)=26 And (PeekB(vData\pData+7) & $FF)=10
;Read Header chunk
If (PeekB(vData\pData+12) & $FF)=73 And (PeekB(vData\pData+13) & $FF)=72 And (PeekB(vData\pData+14) & $FF)=68 And (PeekB(vData\pData + 15) & $FF)=82
Images()\Filter = "FlateDecode"
vReturn = ipf_ParsePNG(vData)
FreeMemory(vData\pData) ; luis - added this line
Else
pdfError = 12 ; "Incorrect PNG file."
EndIf
Else
pdfError = 13 ; "Not a JPEG or PNG file."
EndIf
EndIf
It seem to work here. Let me know !

Posted: Sun Nov 02, 2008 8:10 pm
by ABBKlaus
You are my best betatester
Your bugfix is correct, ipf_ParsePNG is copying the data to a new buffer. So it is correct to delete the old buffer if vReturn = #True !
Regards Klaus
Posted: Tue Nov 04, 2008 9:27 pm
by Hurga
Hello Abb Klaus
MAybe a stupid question.... but what have I to do to write unicode strings in a pdf.
- I use PB 4.2 and Purepdf 2.13
- I enabled "unicode" as compiler option.
- Debug shows me that the strings contain unicode chars.
- If i write them to the pdf, then I shows only questionmarks.
Any hints for this?
Posted: Fri Nov 07, 2008 10:23 pm
by ABBKlaus
@Hurga,
PurePDF is not fully unicode capable, it only uses the ASCII character set.
In the current beta i made an enhancement, with it you can encode at least 511 Bytes of the unicode range (with octal encoding).
Posted: Wed Nov 12, 2008 3:08 pm
by Hurga
Hm.. I not so in with unicode that I really understand what this meen.
So, plain question.
Can I print japanese/chinese letters (Kanji) and hiragana / katakana with this?
(Thats what I would like to do with it

)
Would be great if this would work.
Posted: Wed Nov 12, 2008 8:58 pm
by ABBKlaus
Hurga wrote:Can I print japanese/chinese letters (Kanji) and hiragana / katakana with this?
with the current version : No
Posted: Thu Nov 13, 2008 2:13 pm
by Hurga
OK
Any chance that I can do it with the next version
