How to send generated PDF via API using Base64 format

Formidable Forms
17 September, 2023 23:54:50
RMI
Topics: 1
Messages: 3
Hi support team,

I have an API integration which i need to send my PDF generated from e2PDF to other system using API from formidable form, but the other end only support Base64, can you let me know if this possible?
18 September, 2023 02:11:37
E2Pdf
Support
Topics: 7
Messages: 3335
Hello,

Unfortunately, there is no default option to output the PDF in base64 yet, but as an option, you can try to use a filter to convert the [e2pdf-download] shortcode output base64 encoded PDF: https://codefile.io/f/9P1tyTyima

Using the shortcode as: [e2pdf-download id="1" output="url" esc_url_raw="true" base64="true"] will return base64 encoded PDF. Please note that if you want to call the shortcode via PHP, you must define the "dataset" attribute, i.e. the ID entry.


We would really appreciate your feedback at WordPress.org!
18 September, 2023 21:04:34
RMI
Topics: 1
Messages: 3
Hi,

Thanks for this! really appreciate your fast response and support.

regards,
18 September, 2023 22:17:45
RMI
Topics: 1
Messages: 3
Hi,

One more question please, are we able to output only the file name of the generated PDF? aside from the base64, i am also need to pass the name of the PDF to our system via API.
19 September, 2023 06:23:24
E2Pdf
Support
Topics: 7
Messages: 3335
Hello,

We have the PHP API development in our TODO list to make it easier to interact, however, not yet any ETA. As a temporary solution, we reviewed your request and released an RC version update which has additional hooks for e2pdf-zapier shortcode, which has needed data. Unfortunately, the current version of E2Pdf doesn't allow easily get the name of the PDF. So to use it:

1. It must be updated the plugin to the latest RC version: https://e2pdf.com/docs/install#rc-version

2. After the update, it must be added PHP hook: https://codefile.io/f/ICEFb5ilun, or you can update it to use it for requests to your API directly, as $data includes also additional information like Entry ID.

If you wish to get needed just via shortcodes and via the provided PHP hook:

[e2pdf-zapier id="1" webhook="local" base64="true"] - will output Base64 PDF

[e2pdf-zapier id="1" webhook="local" base64_name="true"] - will output PDF name

The "dataset" attribute is also required if the shortcodes will be called from PHP.

We would really appreciate your feedback at WordPress.org!