PDF Report Generation In Processor - Page 1
Forum section: electronics / projects

author: jmag999
author_rank: Contributor
timestamp: April 30, 2015, 06:29:45 pm
content: Anyone have any advice on generating a PDF report within a microprocessor? I'd like to generate a PDF template, then have the microprocessor fill in the form and write it to a USB thumbdrive. I found libHaru, but it seems pretty heavyweight. Has anyone else had any experience with this?

author: Cliff Matthews
author_rank: Unknown
timestamp: April 30, 2015, 06:57:42 pm
content: A microprocessor is hardware and PDF is a standard file format... two fairly unrelated things here...By microprocessor, do you mean a PC and what OS will you use? Will the OS also boot the PC from the USB?Are you testing PC's to get a hardware report on each and have it stored on the USB drive?Most people who want to auto-generate PDF files do so as a PDF printer (eg: Bullzip, etc.. )http://www.techsupportalert.com/best-free-pdf-writer-software.htmbut some hardware test programs can generate PDF's named by the NetBIOS name of the PC. It shouldn't be hard to script something together.

author: jmag999
author_rank: Contributor
timestamp: April 30, 2015, 07:32:52 pm
content: Let me be more clear. I want to take a PDF template and fill in the data using an STM32 processor. This has nothing to do with a PC and should be OS agnostic (ansi c).

author: gman4925
author_rank: Regular Contributor
timestamp: April 30, 2015, 07:37:36 pm
content: Depends on the processor, but editing a PDF might be a bit much for a 8-bit micro.I would probably forget about PDF and maybe look at writing your report in LaTeX instead and look at including a viewer/converter bundled on the USB drive.

author: gman4925
author_rank: Regular Contributor
timestamp: April 30, 2015, 07:41:03 pm
content: Oops didn't see it was STM32.You might have luck rolling your own, the PDF standard is available from adobe and includes examples of PDF file structures, which don't appear too complicated.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 30, 2015, 09:04:10 pm
content: I suspect the basic process of generating recognizable and readable files will be quite simple (you can do it in plain text Notepad), but calculating the formatting will be a much greater challenge. I don't know that that can be done automatically in PDF.As a general example of document formatting: the MiKTeK package is an 80MB download for Windows. I don't know what a minimal package of pdflatex would entail (it's free software, so you should, in principle, be able to port it to your platform!). It will certainly fit on a flash drive, but that doesn't necessarily mean you would want to use it. It will be file-intensive, and run very slowly, reading and writing from such limited media. The processing power is also a bit on the thin side, but to your advantage, LaTeX comes from the days of sparse RAM, so an ARM M-something should be more than adequate. And being file-intensive, you may prefer a platform that can support Linux embedded, which will consume more program storage, RAM and CPU cycles.Perhaps a worst case would be, you have to add Flash and RAM to your project (using a processor which supports an external memory bus). But I'm guessing that's better avoided.What is the end purpose? You may find it vastly superior to use a different standard. There isn't a commercial computer device in existence which doesn't support HTML -- look it up on your phone, look it up on your desktop, look it up on your printer (ehh, possibly).HTML and LaTeX share some common background, and have a certain amount of equivalency as markup languages (PDF can also be structured as markup I think, but you still have to calculate everything, whereas HTML and LaTeX have defaults, and simple commands allow changes to global and local formatting). The biggest difference being, HTML is always rendered on-demand in the browser, while LaTeX needs to be compiled, so the burden on your system is exponentially smaller. It should be no surprise that embedded systems such as routers easily offer HTML over HTTP as standard portals.Tim

author: Marco
author_rank: Super Contributor
timestamp: April 30, 2015, 09:47:55 pm
content: If you want PDF just to have a single file, you can even embed images directly into a HTML file.

author: Cliff Matthews
author_rank: Unknown
timestamp: April 30, 2015, 11:30:57 pm
content: Does this have to be done by an outboard or autonomous controller? AutoIT script can get a pdf editor to go through the motions (pulling strings from csv's, inserting, naming and saving to specific file-names).https://www.autoitscript.com/site/autoit/On OSX and *nux platforms similar solutions should exist (http://javauto.org/).