Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Add configuration parameter to set PDF file directory #16

Closed
TomDeSmet opened this issue Apr 24, 2023 · 1 comment
Closed

FR: Add configuration parameter to set PDF file directory #16

TomDeSmet opened this issue Apr 24, 2023 · 1 comment

Comments

@TomDeSmet
Copy link

TomDeSmet commented Apr 24, 2023

It would be nice if we could set the directory where we want our PDF's to be saved via a config setting.
Cfr. https://mpdf.github.io/installation-setup/folders-for-temporary-files.html

If I understand correctly, we can do this now by passing a path to the filename argument. However, that doesn't work for me. I need to pass the absolute path to the public folder to be able to write to it (local development).

I also don't think this is good practice as the filename the user sees when downloading the file to his computer now includes the path to the file as well. Which doesn't look nice.

So it would be better in my opinion, if we could specify the path to the directory separate from the filename.

UPDATE
Got this working: I had a / at the beginning of the filepath/name which resulted in very strange behaviour.
It would still be better I think to separate these two parameters.

@cooltronicpl
Copy link
Owner

cooltronicpl commented May 24, 2023

So for over 100 hundred people, the plugin may encounter issues when using two parameters because the path with a folder is passed to the plugin in the examples. However, you have the flexibility to save PDFs in any writable path or by using aliases in the examples.

To securely display PDF documents in the browser without saving them to the /web folder, you can follow the instructions provided in the documentation: Securely Displaying PDF Documents in the Browser Without Saving to the /web Folder.

For testing purposes, you can pass entries as custom parameters in the pdfOptions with your test environment. You have the flexibility to pass any accessible path on your server, such as /tmp or a subfolder within Craft.

Additionally, you can optimize the PDF generation process by exploring the mentioned parameters of MPDF, which may help improve performance. Version 1.1.0 and 0.2.0 of the plugin introduced these optimizations.

However, in most cases, you will be using the @web alias, as the plugin is designed to generate and update multiple PDFs on the first-page load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants