How to duplicate entire page or duplicate field with all its actions into another page

WordPress
11 January, 2023 08:31:21
natacha
Topics: 2
Messages: 8
I am building PDF pages with complex layouts that are controlled by ACF field values. As a result each field has a lot of actions and takes a long time to set up. I now need to duplicate each page 20 times.

Is there a way to either:
A) duplicate the page, keeping all the fields and actions with these, or
B) duplicate a field into another page?

Any other tips or tricks to achieve this?
Otherwise it is going to take me a long time to set up the full document :(
11 January, 2023 08:39:34
natacha
Topics: 2
Messages: 8
THe reason I need this is that I have an 'Artworks' ACF repeater and I am printing each artwork image and details to separate PDF pages.

Another way I was thinking of generating the document is looping through the repeater and calling the shortcode [e2pdf-save id="1" dataset="1"] to generate each PDF page individually. THat way I don't have to repeat the page setup 20 times.

Do you think this would work? I am wondering if there would be an issue with timeouts if the pdf does not have the time to generate before looping.
11 January, 2023 08:47:12
natacha
Topics: 2
Messages: 8
I just found another Help post where you explain how to 'Copy' and 'Paste in Place' - your plugin is amazing!

I would still like to know if generating the PDF pages individualy via a PHP function is possible as this would save a lot of time.

If you have any advice on that I would be grateful. Thank you!
11 January, 2023 08:48:03
E2Pdf
Support
Topics: 7
Messages: 3330
Hi,

You must be able to accomplish the task:

- Create a new page
- Select all needed created fields with the mouse as you do usually with files
- Right Mouse Click on any selected field -> "Copy". All fields must remain selected.
- Right Mouse Click on the newly created page free space -> "Paste In Place" or "Paste"

Using [e2pdf-save id="1" dataset="1"] shortcode also as an option, however, keep in mind that it must be set dynamically generated unique "name" attribute for each shortcode run to avoid E2Pdf overwrite the files.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
11 January, 2023 08:52:50
E2Pdf
Support
Topics: 7
Messages: 3330
P.S. If you plan to call [e2pdf-save] shortcode from PHP it must look like this:

for ($i = 1; $i <= 10; $i++) {
do_shortcode('[e2pdf-save id="1" dataset="1" name="' . $i . '" apply="true"]');
}

"dataset" - must be the correct Post ID, or Page ID depending on your E2Pdf Template connection.

also, keep attention to your PHP max execution time setting, as PDFs will be generated 1 by 1 until completed to not exceed the time limit.
We would really appreciate your feedback at WordPress.org!
11 January, 2023 09:05:38
natacha
Topics: 2
Messages: 8
Thank you for this information - it is very very useful! Thank you!