I'm having difficulties generating a bilingual (English/French) pdf from a resource. Using the mpdf library I'm getting unicode errors.
Does anyone have a working example of the new PDFresource snippet (although this will probably toss out the same error)?
Thanks
Jim
currently Revo 2.4.2
on testing server with XAMPP
Apache/2.4.16
PHP/5.5.28
Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
I have this amazing extra installed and love it!
Your issue might be solved by utf8_decode()
5 years ago:
https://forums.modx.com/thread/24611/pdf-export?page=3#dis-post-125963
One untested idea would be a custom output modifier
snippet:
utf8decode
$output = utf8_decode($input);
return $output;
then in your chunk:
tplPDF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>[[+pagetitle:utf8decode]]</h1>
[[+content:utf8decode]]
</body>
</html>
Thanks mrhaw, The unicode error turned out to be a non-issue caused by the lack of an '. Here is a better explanation of my problem:
I am trying to find a method to generate a PDF file from a MODx 2.4.2 resource. In our case the users complete a certain amount of annual training, or activity participation. We need to generate a PDF file which sumarises their progress over a three year period. The data comes from the database, the file is downloaded and not stored on the server. I can generate the report but cannot seem to accomplish the pdf conversion. Does anyone have a working model to perform such a task.
Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
Are you generating the report in a script outside of MODX? I do believe mPDF can accomplish what you want, it's just some work
getting there!
http://jako.github.io/PDFresource/
http://mpdf1.com/manual/index.php?tid=106
Yes mpdf comes close. Everything is generated inside MODx but I can't get anything in my chunk to render as pdf. Perhaps another day will get me there.
Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
-
☆ A M B ☆
- 1,031 Posts
PDFresource does not generate PDF files on the fly. Only if the PDF does not exist, it will be generated if a system setting is enabled
[ed. note: Jako last edited this post 10 years, 11 months ago.]
Thanks Jako this is looking much better. But for some reason it is dropping some of the placeholders The PDF should look something like: CSAAC_Your_CEP.png instead it renders like Your_CEP_pdf.png. At this point I have not applied any CSS to the pdf. Any ideas?
Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.