![]() |
PDF Generation and Mystery Mania - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7) +---- Thread: PDF Generation and Mystery Mania (/showthread.php?tid=3504) |
PDF Generation and Mystery Mania - justsomeguy - 03-01-2025 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: ![]() 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: RE: PDF Generation and Mystery Mania - bplus - 03-01-2025 +1 PDF PDQ! RE: PDF Generation and Mystery Mania - grymmjack - 03-01-2025 hey @justsomeguy! This is really cool. I will give it a shot. Neat to see you making BASIC -> PDF ![]() RE: PDF Generation and Mystery Mania - Mad Axeman - 03-03-2025 I'll be following this with great interest. It's somthing I've been looking for for a while. Not sure about the scent of lavender though as I'm alergic to it ![]() RE: PDF Generation and Mystery Mania - SpriggsySpriggs - 03-03-2025 Nice, man RE: PDF Generation and Mystery Mania - justsomeguy - 03-04-2025 I managed to get black and white images working. Sorry, I have not commented the code, I will work on that later. ![]() Color should not be that much harder. It currently uses transformation matrices to accomplish position, scale, and rotation. I will add some commands to make them easier to move around in the coming posts. Luckily the _DEFLATE$ command is compatible with the PDF specification, it made the compressing the images easy. I will probably add it as default option on all parts of the PDF. RE: PDF Generation and Mystery Mania - justsomeguy - 03-04-2025 I went ahead and commented the example code. Code: (Select All)
RE: PDF Generation and Mystery Mania - James D Jarvis - 03-04-2025 Wow. Thanks for all the work that went into this. I couldn't manage to get an image to load on the page but the text manipulation is working fine. It was easy to create some subroutines to generate a new pdf. Thanks again. Code: (Select All)
RE: PDF Generation and Mystery Mania - Mad Axeman - 03-04-2025 Is it possible to create a PDF in landscape format? RE: PDF Generation and Mystery Mania - James D Jarvis - 03-04-2025 You could change the size of the mediabox. the defaults in 'pdfGen.bm' is: pdfDefault.mediaBox.b.x = 612 pdfDefault.mediaBox.b.y = 792 change those numbers and you can change the size of the pdf being generated. EDIT: I doublechecked and you can reset them in a program after '$Include:'pdfGen.bi' and it seems to work fine. |