When I try to generate PDF, I just get the following (example with version 2.1.3 and mPDF):
Warning: fopen(my_site/test.pdf): failed to open stream: No such file or directory in Mpdf\Mpdf->Output() (line 9625 of vendor/mpdf/mpdf/src/Mpdf.php).
More or less the same error is reported with any other PDF generator.
When I've downgraded printable to 2.0.3, I've got a more useful error report, pointing me to the conclusion that "my_site" folder is used twice in the generated PDF file path.
The simple solution is to create a symlink in "my_site" folder (my website root):
ln -s . "my_site" (a symlink actually pointing to the same folder)
After that, PDFs are nicely generated with printable 2.0.3 as well as 2.1.3 with mPDF.
With wkhtmltopdf, there is a logo image in PDF, but the text "{PAGENO} / {nb}" appears at the right upper corner.
With dompdf, there is no image and teh same text appears at the top of the generated PDF page.
With tcpdf, the same error still apperas, and no file is generated.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | temp-dir-location-3278263-13.patch | 811 bytes | wtrv |
| #7 | temp-dir-location-3278263-7.patch | 1.44 KB | permanaj |
Issue fork printable-3278263
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nigelcunningham commentedHi there.
The location is configured at /admin/config/user-interface/printable/pdf. If it's left blank, the temporary directory will be used. If you put a value in the location field, it will be used verbatim except for token substitutions and the path will be based at the drupal root if I remember correctly.
The relevant code is at line 368 of modules/printable_pdf/src/Plugin/PrintableFormat/PdfFormat.php if that helps.
Regards,
Nigel
Comment #3
bluegeek9 commentedI am having the same issue. I am using tokens which means the TempDirectory is not prefixed to the pdf. This also means it trys to save the pdf to the current working directory.
I think it would be best to write the pdfs to the TempDirectory regardless on tokens.
Comment #4
bluegeek9 commentedComment #5
bluegeek9 commentedComment #7
permanaj commentedPatch for 3.1.3
Comment #9
nigelcunningham commentedComment #12
wtrv commentedThis should be re-opened. The temp dir should not be added before the configured path. It should only be used when no path is configured.
Comment #13
wtrv commentedAdded patch.
Comment #14
nigelcunningham commentedThanks for your comment. I'll look at this again. Without having done anything on it yet, perhaps we need a solution along the lines of making adding the temp dir optional.