Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Oct 01, 2024 Oct 01, 2024

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!

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript , PDF , PDF forms
710
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 01, 2024 Oct 01, 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)}

View solution in original post

Translate
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
Community Expert ,
Oct 01, 2024 Oct 01, 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)}

Translate
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
Community Expert ,
Oct 01, 2024 Oct 01, 2024

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

 

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

Translate
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
New Here ,
Oct 02, 2024 Oct 02, 2024
LATEST

Thanks PDF Automation Station and Thom Parker for your solutions!
Highly appreciated!
They both worked like a charm 🙂

Translate
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