03-01-2025, 07:17 PM
In my previous post, Mystery Mania an 80's Logic Problem Generator I modified the program to output the puzzle, solution, and graph to a text file so that it could be printed. In its current form, this game is more of a pen and paper experience, at least it was when I played it back in '87.
I was dissatisfied with text file, and decided that it could be better presented in PDF form. So, I wrote a low level PDF generator. It's basically a way to generate PDF files programmatically.
When you run the program and it asks if you want a hard copy, it will put the output in a PDF.
I apologize for the mixed coding styles. But, I wanted to keep the Mystery Mania as close to the original as possible.
An example of its hard copy output:
![[Image: Screenshot-from-2025-03-01-11-32-04.png]](https://i.ibb.co/j9q9Zfz5/Screenshot-from-2025-03-01-11-32-04.png)
For the PDF generator here is a disclaimer:
The PDF generator is still very primitive and low level (Yup). Its currently limited to the built in fonts (researching). It does not currently support images (probably next version). Page size is hard-coded A4 (next version). The output is uncompressed (maybe next version). There is no error checking (Maybe a log?) Not all of the commands have been thoroughly tested(Its fine). Documentation is nonexistent (never ending battle). One sample program (We will see). When running the occasional scent of lavender (as intended).
PDF's are extremely powerful and complex nowadays. The 'PDF Reference v1.7' is over 1300 pages long. I use the 1.0 manual, because its shorter and it has the most useful examples. I don't plan on implementing everything that a PDF can do (i.e. 3D rendering, Media, ...), but there may be some more interactive features like forms that could be added.
If the community wishes, I will continue to work on it and post updates. Feedback welcome.
mysterymania_v1.3_pdf.bas (Size: 17.17 KB / Downloads: 27)
pdfGen.bi (Size: 8.13 KB / Downloads: 24)
pdfGen.bm (Size: 25.39 KB / Downloads: 23)
I was dissatisfied with text file, and decided that it could be better presented in PDF form. So, I wrote a low level PDF generator. It's basically a way to generate PDF files programmatically.
When you run the program and it asks if you want a hard copy, it will put the output in a PDF.
I apologize for the mixed coding styles. But, I wanted to keep the Mystery Mania as close to the original as possible.
An example of its hard copy output:
![[Image: Screenshot-from-2025-03-01-11-32-04.png]](https://i.ibb.co/j9q9Zfz5/Screenshot-from-2025-03-01-11-32-04.png)
For the PDF generator here is a disclaimer:
The PDF generator is still very primitive and low level (Yup). Its currently limited to the built in fonts (researching). It does not currently support images (probably next version). Page size is hard-coded A4 (next version). The output is uncompressed (maybe next version). There is no error checking (Maybe a log?) Not all of the commands have been thoroughly tested(Its fine). Documentation is nonexistent (never ending battle). One sample program (We will see). When running the occasional scent of lavender (as intended).
PDF's are extremely powerful and complex nowadays. The 'PDF Reference v1.7' is over 1300 pages long. I use the 1.0 manual, because its shorter and it has the most useful examples. I don't plan on implementing everything that a PDF can do (i.e. 3D rendering, Media, ...), but there may be some more interactive features like forms that could be added.
If the community wishes, I will continue to work on it and post updates. Feedback welcome.
Code: (Select All)
Commands:
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 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 pdfGen (filename AS STRING)
Fonts Supported:
Courier
Courier-Bold
Courier-Oblique
Courier-BoldOblique
Times-Roman
Times-Bold
Times-Italic
Times-BoldItalic
Symbol
ZapfDingbats
Helvetica
Helvetica-Bold
Helvetica-Oblique
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