03-04-2025, 12:55 AM
I went ahead and commented the example code.
Code: (Select All)
'Simple PDF with Image Example
'$INCLUDE:'pdfGen.bi'
'Always Add page, you need a page to work on
pdfAddPage
'Always Load a Font, "F1" is it Identifier
'Only the built in fonts work, for now
pdfLoadFont "F1", PDF_FONT_TIMES_ROMAN
'Load some Images, "Im1" and "Im2" are the identifiers
pdfLoadImage "IMG.png", "Im1"
pdfLoadImage "img2.png", "Im2"
'Push the current graphic state to the stack
pdfPushGraphicsStack
'Set the Matrix to 100% scale in the X,Y and Translate to 245 ,340
pdfSetImageMatrix 100, 0, 0, 100, 245, 340
'Draw the Image "Im1"
pdfPutImage "Im1"
'Return the graphics state
pdfPopGraphicsStack
'Push the current graphic state to the stack
pdfPushGraphicsStack
'Set the Matrix to 200% scale in the X,Y and Translate to 50 ,250
pdfSetImageMatrix 200, 0, 0, 200, 50, 250
'Draw the Image "Im2"
pdfPutImage "Im2"
'Return the graphics state
pdfPopGraphicsStack
'Begin a Text Block, only do text stuff here
pdfBeginText
'Set font "F1" to size 36
pdfSetFontSize "F1", 36
'Move relative from 0,0 to 200,650. All positions are relative.
'To reset the position back to 0,0 end the text block and begin a new one.
pdfSetPosition 200, 650
'Draw some text
pdfAddText "Image Example"
'End the text block. Always end the text block!
pdfEndText
'Generate The PDF
pdfGen "pdfGenTest.pdf"
SYSTEM
'$INCLUDE:'pdfGen.bm'
2D physics engine https://github.com/mechatronic3000/fzxNGN
Untitled Rouge-like https://github.com/mechatronic3000/Untitled-Rougelike
QB Pool https://github.com/mechatronic3000/QBPool
Untitled Rouge-like https://github.com/mechatronic3000/Untitled-Rougelike
QB Pool https://github.com/mechatronic3000/QBPool