Javascript automatically spawn new page if javascript code runs out of room on current page

New Here ,
Sep 21, 2020 Sep 21, 2020

Copy link to clipboard

Copied

Hello, I have a PDF with 20 options and each option gives the user to personalize the option. I am going to use javascript to populate a receipt based on the options selected. Most will select a few options but if someone wants all 20 options, I will run out of room on a single page to list out the details. Can someone point me in the right direction to spawn a new template automatically?

TOPICS
Acrobat SDK and JavaScript

Views

36

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Sep 21, 2020 Sep 21, 2020
See the Adobe Acrobat SDK JavaScript API Reference, "Template", starting on Page 662 and see examples for "spawn" method examples in page 663. Below is Example 2 taken from page 663, it copies the same template 1 time for the current page, for example. var t = this.templates; var T = t[0]; var XO = T.spawn(this.numPages, false, false); for (var i=0; i<1; i++) T.spawn(this.numPages, false, false, XO); You may want to add a conditionto have this script or similar execute when a user selects al...

Likes

Translate

Translate
Adobe Community Professional ,
Sep 21, 2020 Sep 21, 2020

Copy link to clipboard

Copied

LATEST

See the Adobe Acrobat SDK JavaScript API Reference, "Template", starting on Page 662 and see examples for "spawn" method examples in page 663. Below is Example 2 taken from page 663, it copies the same template 1 time for the current page, for example.

 

var t = this.templates;
var T = t[0];
var XO = T.spawn(this.numPages, false, false);
for (var i=0; i<1; i++) T.spawn(this.numPages, false, false, XO);

 

You may want to add a conditionto have this script or similar execute when a user selects all 20 options in your PDF.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines