Skip to main content
dennisg61314509
Participant
October 1, 2024
Answered

Possible to Extract/List All Template Names within a PDF-file?

  • October 1, 2024
  • 1 reply
  • 757 views

Hi,

 

Is it possible to Extract All existing Template Names within a PDF-file (using Adobe Acrobat DC Pro)?

 

I'm working with a PDF-file with a Great number of Templates with different Names.

 

The reason that I'm asking because,

I'm spawning pages and Calls different ones if certain condition is met.

 

E.g.:

In one scenario these pages could spawned at once (some times many more could be spawned):

getTemplate("Job_1 of 100").spawn(this.numPages, false, false);

getTemplate("Mike_3 of 100").spawn(this.numPages, false, false);
getTemplate("Pluto_5 of 45").spawn(this.numPages, false, false);

 

I have a Custom-Made JavaSript "List All Fields" (purchased from Try67) which Extracts and List All Form Fields within a PDF-file, to a text-file (.txt). So I wonder if something similar can be done to extract Template names..?

 

So I guess I'm just wondering if somehow this could me managed E.g. by:

 

-JavaScript code?

-Returning this in the JavaScript Console?

-Custom-Made JavaScript Add-on?

 

Thanks in advance!

This topic has been closed for replies.
Correct answer PDF Automation Station

Run the following script in the console:

var tmpl=this.templates;

for(var i=0;i<tmpl.length;i++)

{console.println(tmpl[i].name)}

1 reply

PDF Automation Station
Community Expert
Community Expert
October 1, 2024

Run the following script in the console:

var tmpl=this.templates;

for(var i=0;i<tmpl.length;i++)

{console.println(tmpl[i].name)}

Thom Parker
Community Expert
Community Expert
October 2, 2024

or simply type the single word "templates" on a line in the console and run it. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often