Hello MODx supporters,
I'm trying to dynamically generate PDF-files within a snippet, using FPDF. Problem is, I can't get MODx (Revo 2.3.2) to output the result. I want to call the snippet from a resource, if I set the content type of that resource to PDF, the resource is a binary one, with the drawback, that the content is never parsed, so the resulting PDF-file is just "[[!mypdfsnippet]]", the actual snippet never been called.
The other option would be to create a custom content type for pdf-Files, and set it to non-binary content, thus the snippet beeing parsed. This approach fails, because binary data within the result breaks the output (e.g. images are cropped).
Third approach was to write a plugin for the event OnWebPagePrerender and call the snippet manually. This fails, because the plugin is never called for binary resources.
Approach #4 was to send the result to the browser from within a (non-binary) html-resource. This fails, because modx already sent the headers, so I can't sent binary data with corresponding headers.
Is there any solution (apart from doing the job within an external PHP-file, which I don't want, because I need to access a lot of snippets and XPDO-database-objects, don't want to recreate the whole MODx-story outside of MODx)?
Any help appreciated, cheers,
Roland
[ed. note: rwkstgtd last edited this post 11 years, 10 months ago.]