PurePDF Version 2.0
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Great! Perhaps we can create a new command like "pdf_SaveEmbedFiles(PdfFile$, ToPath$)"
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Yes, here are the BETA links to PurePDF v2.14 :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...
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()
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.
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.
@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
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
Klaus, seems perfect so far, thank you so much!ABBKlaus wrote:@luis,
could you try "Tutorial28 PageFormat.pb" and check if it fits your needs.
Klaus
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
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
thanks luis,
your code is in the latest version now.
http://www.purebasicpower.de/downloads/ ... B43X86.zip
Changes so far :
your code is in the latest version now.
http://www.purebasicpower.de/downloads/ ... B43X86.zip
Changes so far :
Klaus- added louis code
- added pdf_SetALaunch()
- added pdf_SetAText()
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.
The leakage goes away if you add a FreeMemory() in ipf_ParseImage(FileName$) :
It seem to work here. Let me know !
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
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?
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?