Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PDF Generation and Mystery Mania
#7
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'

Reply


Messages In This Thread
PDF Generation and Mystery Mania - by justsomeguy - 03-01-2025, 07:17 PM
RE: PDF Generation and Mystery Mania - by bplus - 03-01-2025, 07:22 PM
RE: PDF Generation and Mystery Mania - by justsomeguy - 03-04-2025, 12:55 AM



Users browsing this thread: 21 Guest(s)