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

automatically make the file name appear on all pages

New Here ,
Jan 12, 2023 Jan 12, 2023

Hello!. 

I need that when printing a pdf in pdf, automatically make the file name without the extension appear on all pages.

 I am a draftsman and I do the exploded views of my company's machines. When we enter these exploded views into the production program, the program reprints the pdf to pdf and names it with the name of the production list, which the pdf file has been associated with. What I need is that, at the moment of creating this pdf, in a field of the document pages, as if it were one of the fields in the footer or the header, the name of the file would appear. We need this, so that each exploded view can be associated with a production list.

 

Thank you

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms , Print and prepress
733
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 ,
Jan 12, 2023 Jan 12, 2023

You can place a readonly field on a page where you want and use this as that field custom calculation script to get document name without extension:

var str = this.documentFileName.split(".");
event.value = str[0];

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 ,
Jan 12, 2023 Jan 12, 2023

If the file name contains a period in it that won't correctly. Use this instead:

event.value = this.documentFileName.replace(/\.pdf$/i, "");

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 ,
Jan 12, 2023 Jan 12, 2023
LATEST

You'll find a free file name stamper tool here:

https://acrobatusers.com/actions-exchange/

 

And a better paid for tool here:

https://www.pdfscripting.com/public/File-Name-Stamper-Action-Description.cfm

 

 

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