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

Specific Bates numbering question

Explorer ,
Mar 08, 2022 Mar 08, 2022

Hi,

I have around a 100 files that need to be Bates numbered. Each file consists of 1-10 pages. 

I want all the pages of a single file to get the same bates number, so e.g. file number one, page 1 - 10 all need to have bates number 00001, all the pages from file 2 need to have batesnumber 00002, etc.

 

I cannot figure it out, any Bates number professionals that can help me? Thanks in advance

 

TOPICS
General troubleshooting
2.0K
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 ,
Mar 08, 2022 Mar 08, 2022

Glad to hear it! And yes, what you ask for is a bit more complicated, but possible.

Try this code:

 

if (global.fileCounter==null)
	global.fileCounter = 0;
global.fileCounter++;
var mm = 2.83465;
var batesText = "DOC-"+util.printf("%05d", global.fileCounter);
for (var p=0; p<this.numPages; p++) {
	this.addWatermarkFromText({cText: batesText + "/" + (p+1), nTextAlign: app.constants.align.right, cFont: "Arial", nFontSize: 16, nStart: p, nEnd: p,
		aColor: color.black, nHorizAlign: app.constants.align.right, nVertAlign: app.constants.align.top, nHorizValue: -12*mm, nVertValue: -12.7*mm
	});
}
if (this.numPages==1) {
	this.saveAs(this.path.replace(this.documentFileName, batesText + " " + this.documentFileName.replace(/\.pdf$/i, " (pag. 1).pdf")));
} else this.saveAs(this.path.replace(this.documentFileName, batesText + " " + this.documentFileName.replace(/\.pdf$/i, " (pag. 1 tm pag. "+this.numPages+").pdf")));

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 ,
Mar 08, 2022 Mar 08, 2022

You would need to do it using a script, as a part of an Action.

Does the order in which the files are processed matter to you? Because it's not easy controlling that in an Action. If it doesn't then please specify where you want those numbers to appear on the pages, and what they should look like, and I'll help you with the script for it.

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
Explorer ,
Mar 08, 2022 Mar 08, 2022

Yes, unfortunately the order of the files matters a lot. Can it still be done then? We have to do this every so often and it would save a absurd amount of time if we can do it in bulk. I hope u can still help me.

 

Below are the settings used for the Bates numbers. 

Font: Arial

Font size: 16
Margins:

Top: 12,7
Below: 12,7

Left: 25,4

Right: 12

 

The files should be named DOC-00000 (and on the part of the zero's there should be the numbers)

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 ,
Mar 08, 2022 Mar 08, 2022

What are the units of these measurements you specified?

 

Regarding the order: You will have to play around with it and see how it can work for you.

You might have to select the files manually, instead of selecting them as a folder.

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
Explorer ,
Mar 08, 2022 Mar 08, 2022

The units are in Millimeters.

As I can tell, only the Top and Right margin are used. So 12,7 millimeters from the top and 12 milimeters from the right.

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 ,
Mar 08, 2022 Mar 08, 2022

Yes, that's correct. Also, you mentioned something about renaming the file. That's not going to be possible. You can only save a copy of it under a new name. Do you want to use the bates number text for that?

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
Explorer ,
Mar 08, 2022 Mar 08, 2022

Yes, if possible the file name should be the same as the old one with the Bates number before it. So if the old file name was "financials 2009" the new name should be "DOC-00001 Financials 2009", it is totally fine if it is a copy.

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 ,
Mar 08, 2022 Mar 08, 2022

OK, then you can do it using this JavaScript code, as a part of an Action (via Tools - Action Wizard):

 

if (global.fileCounter==null)
	global.fileCounter = 0;
global.fileCounter++;
var mm = 2.83465;
var batesText = "DOC-"+util.printf("%05d", global.fileCounter);
this.addWatermarkFromText({cText: batesText, nTextAlign: app.constants.align.right, cFont: "Arial", nFontSize: 16,
	aColor: color.black, nHorizAlign: app.constants.align.right, nVertAlign: app.constants.align.top, nHorizValue: -12*mm, nVertValue: -12.7*mm
});
this.saveAs(this.path.replace(this.documentFileName, batesText + " " + this.documentFileName));

 

To reset the counter you will need to restart Acrobat after each run. If you run it twice in a row it will continue counting from the last number used in the first run.

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
Explorer ,
Mar 08, 2022 Mar 08, 2022

How do I apply this to all the documents? When I open one file and I go to Actions->Javascript->JavaScript-scripts of the document. Then I make a scriptname and I add in the script. The file I have open ineeds gets the number at the perfect spot, but how I apply this in bulk?

If I open a few files e.g. Finacials 2009, financials 2010 and financials 2011. Now I have 3 tabs open. If  Financials 2009 is the active tab and I follow the steps above only Financials 2009 gets a number. What am I doing wrong?

 

 

 

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 ,
Mar 08, 2022 Mar 08, 2022

That's not how I described to use it... Please read my previous reply more carefully.

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
Explorer ,
Mar 08, 2022 Mar 08, 2022

Sorry, I completely misread your answer. IT WORKS, I am so thankfull! This is gonna save me countless hours! Thank you so much already.

 

If you don't mind me asking, I have two more additions to my request, to just automize everything. 

The individual pages now all have DOC-00001 stamped in the top right corner. Is it also possible to add pagenumbers behind the DOC-00001? So that file 1, page 1 has stamped DOC-00001/1 in the top right corner and page 2 has stamped DOC-0000/2. While file 2, page 1 has stamped DOC-00002/1 and page two has DOC-00002/2, etc.

 

And secondly for the file names, 

We take "Financial 2009" again as an example. With the current script the document is going to be saved as "DOC-00001 Financial 2009". Would it also be possible to add the page numbers behind Financial 2009? As in "DOC-00001 Financial 2009 (pag. 1 tm pag. x)" in which x is the last page. So that when I run the Script over Financial 2009 that has 10 pages, the file name is going to be saved as "DOC-00001 Financial 2009 (pag. 1 tm pag. 10)".  And as an exception if the document has just one page, the file is going to be named DOC-00001 Financial 2009 (pag. 1)

 

Would my requests be possible or is that going to be too complicated?
Thanks again already for all your work. 

Kind regards.

 

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 ,
Mar 08, 2022 Mar 08, 2022

Glad to hear it! And yes, what you ask for is a bit more complicated, but possible.

Try this code:

 

if (global.fileCounter==null)
	global.fileCounter = 0;
global.fileCounter++;
var mm = 2.83465;
var batesText = "DOC-"+util.printf("%05d", global.fileCounter);
for (var p=0; p<this.numPages; p++) {
	this.addWatermarkFromText({cText: batesText + "/" + (p+1), nTextAlign: app.constants.align.right, cFont: "Arial", nFontSize: 16, nStart: p, nEnd: p,
		aColor: color.black, nHorizAlign: app.constants.align.right, nVertAlign: app.constants.align.top, nHorizValue: -12*mm, nVertValue: -12.7*mm
	});
}
if (this.numPages==1) {
	this.saveAs(this.path.replace(this.documentFileName, batesText + " " + this.documentFileName.replace(/\.pdf$/i, " (pag. 1).pdf")));
} else this.saveAs(this.path.replace(this.documentFileName, batesText + " " + this.documentFileName.replace(/\.pdf$/i, " (pag. 1 tm pag. "+this.numPages+").pdf")));
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
Explorer ,
Mar 09, 2022 Mar 09, 2022
LATEST

I don't know how to thank you... It works like a charm. It is absolutely fantastic, thanks again for all your help.

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
Explorer ,
Mar 08, 2022 Mar 08, 2022

And the Bates number should appear on the top right corner of the file. 

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