03-04-2025, 11:16 PM
@James D Jarvis and @Mad Axeman as of this last version I added a command called "pdfMediaBox" that allows you to set the size of the page. According to PDF spec the minimum is 3 x 3 (approximately 0.04 by 0.04 inch) and the maximum is 14,400 x 14,400 (200 by 200 inches).
The defaults are as pointed out are 612 x 792 (A4 paper size). To switch to landscape, simply switch 792 and 612.
'pdfMediaBox 0, 0, 792, 612'
You will need to do this before you add a page. Although, I have not tested it, you should be able to make each page a different size if you wish.
James I looked over your code, I'm not sure if you accomplished what you were trying to do, but all positions are relative. So, if you move to top middle, like 306,750, and you want to move to the next line. You could manually move down by using the pdfSetPosition 0, -30. Or if you have pdfSetLeading set to character height, you can use pdfNextLine.
If you want to print a block of text, you can use pdfAddTextBlock. You set maximum line length in characters, and it will automatically find the last space (I need to add hyphen) and start it on the next line. Of course pdfSetLeading has to be set as well.
Quite frankly I'm not surprised. I apologize. I was so focused on making sure the encoding into the pdf was correct, I did not spend much time on the gathering of pixel data from the file. When it worked, I was so happy, I had to share it. This weekend if not sooner I'm going try to get the image stuff in a much better state.
Here is updated list of commands.
The defaults are as pointed out are 612 x 792 (A4 paper size). To switch to landscape, simply switch 792 and 612.
'pdfMediaBox 0, 0, 792, 612'
You will need to do this before you add a page. Although, I have not tested it, you should be able to make each page a different size if you wish.
James I looked over your code, I'm not sure if you accomplished what you were trying to do, but all positions are relative. So, if you move to top middle, like 306,750, and you want to move to the next line. You could manually move down by using the pdfSetPosition 0, -30. Or if you have pdfSetLeading set to character height, you can use pdfNextLine.
If you want to print a block of text, you can use pdfAddTextBlock. You set maximum line length in characters, and it will automatically find the last space (I need to add hyphen) and start it on the next line. Of course pdfSetLeading has to be set as well.
Quote:I couldn't manage to get an image to load on the page but the text manipulation is working fine.
Quite frankly I'm not surprised. I apologize. I was so focused on making sure the encoding into the pdf was correct, I did not spend much time on the gathering of pixel data from the file. When it worked, I was so happy, I had to share it. This weekend if not sooner I'm going try to get the image stuff in a much better state.
Here is updated list of commands.
Code: (Select All)
SUB pdfAddPage
SUB pdfLoadFont (nm AS STRING, fnt AS STRING)
SUB pdfSetPosition (x AS LONG, y AS LONG)
SUB pdfAddText (s AS STRING)
SUB pdfAddTextBlock (l AS LONG, s AS STRING)
SUB pdfBeginText
SUB pdfEndText
SUB pdfNextLine
SUB pdfSetRenderMode (m AS LONG)
SUB pdfSetGrayScaleStroke (g AS SINGLE)
SUB pdfSetGrayScaleNonStroke (g AS SINGLE)
SUB pdfSetStrokeWidth (sw AS LONG)
SUB pdfSetCharacterSpacing (s AS SINGLE)
SUB pdfSetWordSpacing (s AS SINGLE)
SUB pdfSetHorizontalScaling (s AS LONG)
SUB pdfSetLeading (l AS SINGLE)
SUB pdfSetRise (l AS LONG)
SUB pdfRotateText (x AS LONG, y AS LONG, deg AS SINGLE)
SUB pdfSetMatrix (a AS SINGLE, b AS SINGLE, c AS SINGLE, d AS SINGLE, e AS SINGLE, f AS SINGLE)
SUB pdfSetImageMatrix (a AS SINGLE, b AS SINGLE, c AS SINGLE, d AS SINGLE, e AS SINGLE, f AS SINGLE)
SUB pdfPutImage (nm AS STRING)
SUB pdfSetFontSize (nm AS STRING, sz AS LONG)
SUB pdfBeginPath (x AS LONG, y AS LONG)
SUB pdfAppendLine (x1 AS LONG, y1 AS LONG)
SUB pdfAppendBezier123 (x1 AS LONG, y1 AS LONG, x2 AS LONG, y2 AS LONG, x3 AS LONG, y3 AS LONG)
SUB pdfAppendBezier23 (x2 AS LONG, y2 AS LONG, x3 AS LONG, y3 AS LONG)
SUB pdfAppendBezier13 (x1 AS LONG, y1 AS LONG, x3 AS LONG, y3 AS LONG)
SUB pdfClosePath
SUB pdfRectangle (x AS LONG, y AS LONG, w AS LONG, h AS LONG)
SUB pdfStrokePath
SUB pdfCloseStrokePath
SUB pdfFillPath
SUB pdfFillEO
SUB pdfFillStroke
SUB pdfFillStrokeEO
SUB pdfCloseFillStroke
SUB pdfCloseFillStrokeEO
SUB pdfEndPath
SUB pdfSetColorStroke (r AS SINGLE, g AS SINGLE, b AS SINGLE)
SUB pdfSetColorNonStroke (r AS SINGLE, g AS SINGLE, b AS SINGLE)
SUB pdfPushGraphicsStack
SUB pdfPopGraphicsStack
SUB pdfMediaBox (x AS LONG, y AS LONG, x1 AS LONG, y1 AS LONG)
SUB pdfLoadImage (f AS STRING, nm AS STRING)
SUB pdfGen (filename AS STRING)
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