Copy link to clipboard
Copied
Hi,
I've got a document with multiple pages. All pages sized are A4.
I have a script adding a blank page before spawning the the selected template using a button (js).
The added blank page is always a Letter size which is wider and shorter, resulting in issues.
How can I set pages default size, or how can I code the size to be A4 once i create the blank page?
Thanks all.
this.newPage() takes width and height parameters in points. If they are ommitted the default is 8.5 inches by 11. Change this this.newPage(1) to this.newPage(1, 595, 842);
Copy link to clipboard
Copied
How do you add the blank page?
Copy link to clipboard
Copied
this.newPage()
Copy link to clipboard
Copied
What is your script to add the blank page? If you are using this.insertPages(), the blank page you add should be one that is size A4. To create a blank page you can run app.newDoc() in the console. It takes 2 input parameters: width in points, and height in points. For A4 I believe the script is:
app.newDoc(595,842);
You could also crop the page, but this won't work if the end user has Reader. Inserting pages won't either. In this case you could spawn a hidden blank template page. If the page you spawn is the correct size you shouldn't have any issues.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
this.newPage() takes width and height parameters in points. If they are ommitted the default is 8.5 inches by 11. Change this this.newPage(1) to this.newPage(1, 595, 842);
Copy link to clipboard
Copied
Awesome! Thank you so much. "this.newPage(1, 595, 842);" Worked like a charm.
Could you please tell me how exactly you can inpect the current page size for my future reference?
Again, many thanks!
Copy link to clipboard
Copied
In the above script, 595 is the width in points and 842 is the height in points. There are 72 points per inch so the script could also be written like this:
this.newPage(1,Math.round(8.26*72),Math.round(11.7*72));
OR
You could use the existing size of the current page like this:
var size = this.getPageBox("Crop", this.pageNum);
this.newPage(1, size[2], size[1]);