Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you!!
Copy link to clipboard
Copied
Hello ReinhardF
great script, just does what I expected. One Question
Line:
& " | fd.textSize=6; "&vbLF _ |
I changed Textsize to 10 and it works fine, but is there a possibility to get the textstyle bold? I tried:
& " | fd.textStyle=bold; "&vbLF _ |
but didn't work. I don't to the Scripting Parameters so I ask in this Forum.
Copy link to clipboard
Copied
Hi,
there exists no property "textStyle". You have to choose a font in bold. So font:
font.TimesB, font.HelvB, font.CourB
can be used. If you add a I at the end it will be bold+Italic.
So you can Write (in above VBS file):
&" fd.textSize=10; fd.textFont = font.TimesB; "&vbLF_
Pay attention to the point that JS is case sensitive.
Load down the AcroJs.pdf helpfile and have a look at the Field Object -> Field properties.
So you may use textColor or fieldBorder or ...
Good luck, Reinhard
PS: That just gives me the idea to change the VBS-files so that the js-variable will be set by reading saved poor JS-Code.
That avoid the change to vbs-writing (&" "&vbLF), the js-code could directly tested in the acrobat-js-console and all saved versions could be executed by selecting the file. I think I will put it on my list.
Copy link to clipboard
Copied
Reinhard,
To give users some variety, they can also use non-bold fonts, so brief font list looks like this:
fd.textFont = fontname;
where fontname can be:
font.Times
font.TimesB
font.Helv
Font.HelvB
font.Cour
font.CourB
We're taqlking about text in a footer, so you should not need more variety than this.
Yours,
Michael F
========
Copy link to clipboard
Copied
"...... so you should not need more variety than this."
They have it already. You forgot the italic fonts - lol. 🙂
Copy link to clipboard
Copied
For googlers who find this thread down the road:
I made a tool to batch stamp PDF filenames. You can get it here:
http://saintjohnny.com/pdffilenamelabeler
I've also added so that you can also stamp prefix/suffix before and after the filename, as well as stamp custom text ignoring filenames, and change the height of the stamp to go on the top of the page as a header if needed. Since this isn't a true footer/header, it retains the information when combining PDFs later on which is a plus.
Copy link to clipboard
Copied
Perhaps someone has already suggested this, but if you are using Acrobat Pro (I'm on 11.0.0), go to Tools (now located on the upper right of the PDF) > Print Production > Add Printer Marks > Page Information. This will place the filename on the lower left of your PDF. You can also add trim, reg marks, and color bars, etc.
Copy link to clipboard
Copied
The script to print filename in footer is great, but is there a way to print the filename ie in top or bottom center of the "selected view"?
Copy link to clipboard
Copied
One can use the add water mark from text to place the file name anywhere on the page. One could also add a field to any location on the page and set it's value to the file name.
Copy link to clipboard
Copied
I really don't understand all this Java Script stuff. Why, oh why, is this not built into the basic product? Seems like a NO BRAINER. Absolutely should not take a programmer to do this simple task...
Just saying...
Copy link to clipboard
Copied
Acrobat is pretty well bloated so adding many features that are not commonly used would just add the bloat.
When PDfs were introduced, it was to be a type of universal cross platform document reader and only a few users has the tools to create PDFs, sort of like the original Mac and Lisa. In order to keep backward compatibility for all versions of PDFs Adobe has kept the original design and scripting, unlike MS Word that has more than once changed the VBA code.
Copy link to clipboard
Copied
Thank you everybody for the great inputs. I had a play of the javascript myself and got quite confused by the box coordinate.
1) Is x1,y1 the left lower hand corner of the box, and x2 y2 the right upper corner of the box?
2) The ToWidth business got me confused. For example if I just want to put the filename, in font size 5, in the very top right hand upper corner of the page, how do I code the [x1, y1, x2, y2] square box in the code please?
I would like to insert filename into the far right upper corner header of every document. Document one may have 1000 x 1600 pixels per page; document two may be 600 x 800 pixels only; document three may be 1080 x 1024 per page for example. How do I program the square box so it automatically calculates and fits the filename to the further top right hand corner every time please?
By the way there is a free software written by someone using C# you can download and do the job quickly without understanding anything. It is here: by a guy called Saint Johnny. His program is called: PDF Filename Labeller.
How To Batch PDF Filename, text date,time and Image Stamper (free) - YouTube
How To Batch PDF Filename, text date,time and Image Stamper (free) - YouTube
Commercial software like Nitro also lets you put variables into the header or footer. However I do not know what the variable is called for filename and path. Would anyone know please?
Enjoy.