PDF Document
PDF Document
Hi.
How can I create a PDF document? The example on HELP for PdfVectorOutput doesn't work and says it is not supported.
Thank you in advance
How can I create a PDF document? The example on HELP for PdfVectorOutput doesn't work and says it is not supported.
Thank you in advance
Re: PDF Document
Use right PB version ?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: PDF Document
PDF output for Windows is new for 6.10, it's Mac/Linux only in previous versions. The example shown in the help article for PdfVectorOutput() won't actually work (on Windows). It tries to write to a read only folder and fails with no error message. It needs updating. Try this, it should work properly:
(Edit: Removed an extraneous separator).
Code: Select all
LoadFont(0, "Times New Roman", 20)
File$ = GetTemporaryDirectory() + "test.pdf"
If StartVectorDrawing(PdfVectorOutput(File$, 595, 842))
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("This is page 1...")
NewVectorPage()
MovePathCursor(20, 20)
DrawVectorText("This is page 2...")
StopVectorDrawing()
EndIf
RunProgram(File$)
Last edited by spikey on Fri Mar 15, 2024 11:28 am, edited 1 time in total.
Re: PDF Document
One #PS$ too much ...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: PDF Document
Oops, I missed that. Note to self: Put the right glasses on when programming, not the first pair that come to hand...
Re: PDF Document
Can we use this to convert a loaded image into a PDF document? Would be amazing if so!
Re: PDF Document
YesBarryG wrote: Wed Mar 20, 2024 12:12 am Can we use this to convert a loaded image into a PDF document? Would be amazing if so!
Code: Select all
LoadFont(0, "Lucida Console", 8)
LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/PureBasicLogo.bmp")
If StartVectorDrawing(PdfVectorOutput("c:\\apps\test.pdf", 595, 842))
VectorFont(FontID(0), 8)
rowHt = VectorTextHeight("Wg")+2
MovePathCursor(20, 20)
DrawVectorText("line 1 ; no indent")
MovePathCursor(20, 20+rowHt)
VectorSourceColor(RGBA(255, 0, 0, 255))
DrawVectorText(" line 2 ; indented")
MovePathCursor(50, 50)
DrawVectorImage(ImageID(0), 127)
StopVectorDrawing()
EndIfRe: PDF Document
Thanks so much, TassyJim!
I shortened it to this for my needs:
Code: Select all
UseJPEGImageDecoder()
LoadImage(0,"d:\image.jpg")
If StartVectorDrawing(PdfVectorOutput("d:\test.pdf",ImageWidth(0),ImageHeight(0)))
DrawVectorImage(ImageID(0))
StopVectorDrawing()
EndIf
- Fangbeast
- PureBasic Protozoa

- Posts: 4792
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: PDF Document
You sound a lot like me. 4 different pair of glasses, all necessary and I still put the wrong damned ones on.Note to self: Put the right glasses on when programming, not the first pair that come to hand...
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: PDF Document
rack and stack em!Fangbeast wrote: Wed Mar 20, 2024 6:53 amYou sound a lot like me. 4 different pair of glasses, all necessary and I still put the wrong damned ones on.Note to self: Put the right glasses on when programming, not the first pair that come to hand...

