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

turn N -up pages per sheet to 1Page per sheet

Engaged ,
Sep 08, 2023 Sep 08, 2023

I have pdf file consists of 31 pages , each page contain 8 images , each of them size is 8.6 * 5.5 cm 

Is there a script or automatic method to save each image as a single pdf page with its size ( 8.6 * 5.5 cm ) ?

Note : Images that I want to save each as single pdf page is marked by red rectangle in the example image attached here

Thanks

 

TOPICS
JavaScript , PDF , Print and prepress
31.6K
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 ,
Sep 10, 2023 Sep 10, 2023

In fact that was not too long.

Forget my "86x55_BB.pdf" file and only open your "Test.pdf" file, then run this script from the console window.

//
var largeur=86;
var hauteur=55;
var offsetH=-16.5;
var deltaH=91;
var offsetV=31;
var deltaV=60;
//
var mm2pt=72/25.4;
var nbPages=this.numPages;
for (var p=0; p<nbPages; p++) {
	for (v=0; v<4; v++) {
		for (h=0; h<2; h++) {
			this.newPage({
				nWidth: largeur*mm2pt,
				nHeight: hauteur*mm2pt
			});
			this.addWatermarkFromFile({
				cDIPath: this.path,
				nSourcePage: p,
				nStart: this.numPages-1,
				nHorizAlign: app.constants.align.left,
				nVertAlign: app.constants.align.top,
				nHorizValue: (offsetH-h*deltaH)*mm2pt,
				nVertValue: (offsetV+v*deltaV)*mm2pt
			});			
		}
	}
}
this.deletePages(0,nbPages-1);
this.saveAs(this.path.replace(/.pdf$/i," \(One Image Per Page\).pdf"));

 Is that working fine? Let me know.

@+ 

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
Engaged ,
Sep 08, 2023 Sep 08, 2023

Any help Here

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 ,
Sep 08, 2023 Sep 08, 2023

Hi,

Place the attached file in the same folder as your file then open it and run this script from the console window:

 

//
var offsetH=-16.5;
var deltaH=91;
var offsetV=31;
var deltaV=60;
//
var aRect=this.getPageBox();
var thePath=this.path;
var directory=thePath.substring(0,thePath.length-this.documentFileName.length);
var theFile=directory+"Test.pdf";
var mm2pt=72/25.4;
var otherDoc=app.openDoc(theFile);
var nbPages=otherDoc.numPages;
otherDoc.closeDoc();
for (var p=0; p<nbPages; p++) {
	for (v=0; v<4; v++) {
		for (h=0; h<2; h++) {
			this.newPage({
				nWidth: aRect[2],
				nHeight: aRect[1]
			});
			this.addWatermarkFromFile({
				cDIPath: theFile,
				nSourcePage: p,
				nStart: this.numPages-1,
				nHorizAlign: app.constants.align.left,
				nVertAlign: app.constants.align.top,
				nHorizValue: (offsetH-h*deltaH)*mm2pt,
				nVertValue: (offsetV+v*deltaV)*mm2pt
			});			
		}
	}
}
this.deletePages(0);
this.saveAs(this.path.replace(/.pdf$/i," \(One Image Per Page\).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
Engaged ,
Sep 08, 2023 Sep 08, 2023

Thanks for your great effort

But Sorry , I'm new in acrobat dc scripts , how can I run the script

I reached to this image attched but nothing done

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 ,
Sep 08, 2023 Sep 08, 2023

Hi,

  1. The 86x55_BB.pdf file must be in the same folder as your Test.pdf file.
  2. Open the 86x55_BB.pdf file.
  3. Paste the script in the console window.
  4. Capture d’écran 2023-09-09 à 08.23.34.png
  5. Select all the script (with ctrl A).
  6. Capture d’écran 2023-09-09 à 08.24.06.png
  7. Press the ENTER key of the numerical panel (not the Return key of the alphabetical panel).
  8. The script must run then you will get a new file with one image per page.
  9. Capture_d’écran_2023-09-09_à_08_31_02.png

Please note that the script can't check if there is effectively an image on each page and extract 8 images per page.

So, as on your last page you only have one image, it will extract 7 blank pages at the end of the new 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
Engaged ,
Sep 09, 2023 Sep 09, 2023

Thanks For Your reply

I made the steps exactly but when i pressed ( Enter ) 

Undefined is wrote under the script and a new empty file created with name  : 86x55_BB (One Image Per Page) consist of one empty page ( same as file that you attached )

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 ,
Sep 09, 2023 Sep 09, 2023

???

when you run the script, does the process take a few time or is the result immediately?

@+

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
Engaged ,
Sep 09, 2023 Sep 09, 2023

No , It doesn't take any time , result immediately .

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
Engaged ,
Sep 10, 2023 Sep 10, 2023

Hi 

Is there any news about this problem ?

I think that related to the path of Test.pdf file in the script

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 ,
Sep 10, 2023 Sep 10, 2023

Hi,

... me too!!!

I have an idea for an other script but I have no time today (sorry). I will give it later in the evenening or tomorrow morning.

Waiting for, could you run these lines from the "86x55_BB.pdf" file.

var thePath=this.path;
var directory=thePath.substring(0,thePath.length-this.documentFileName.length);
var theFile=directory+"Test.pdf";
var otherDoc=app.openDoc(theFile);

  That should open the "Test.pdf" file... let me know.

@+

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
Engaged ,
Sep 10, 2023 Sep 10, 2023

No problem , take your time , I'll wait you 

Is these 4 lines I test them alone ? or put them in the first script you attached ? or How ?

when I tested them alone this message apears : ReferenceError: theFile is not defined
1:Console:Exec
undefined

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 ,
Sep 10, 2023 Sep 10, 2023

In fact that was not too long.

Forget my "86x55_BB.pdf" file and only open your "Test.pdf" file, then run this script from the console window.

//
var largeur=86;
var hauteur=55;
var offsetH=-16.5;
var deltaH=91;
var offsetV=31;
var deltaV=60;
//
var mm2pt=72/25.4;
var nbPages=this.numPages;
for (var p=0; p<nbPages; p++) {
	for (v=0; v<4; v++) {
		for (h=0; h<2; h++) {
			this.newPage({
				nWidth: largeur*mm2pt,
				nHeight: hauteur*mm2pt
			});
			this.addWatermarkFromFile({
				cDIPath: this.path,
				nSourcePage: p,
				nStart: this.numPages-1,
				nHorizAlign: app.constants.align.left,
				nVertAlign: app.constants.align.top,
				nHorizValue: (offsetH-h*deltaH)*mm2pt,
				nVertValue: (offsetV+v*deltaV)*mm2pt
			});			
		}
	}
}
this.deletePages(0,nbPages-1);
this.saveAs(this.path.replace(/.pdf$/i," \(One Image Per Page\).pdf"));

 Is that working fine? Let me know.

@+ 

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
Engaged ,
Sep 10, 2023 Sep 10, 2023

I run the script on my Test.pdf

A new file created : Test (One Image Per Page).pdf , is same as old Test.pdf file

No change occured

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 ,
Sep 10, 2023 Sep 10, 2023

Exactly the same file as your "Test.pdf" file???

Let me think today...

@+

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
Engaged ,
Sep 10, 2023 Sep 10, 2023

Exactly the same file , take your time , I'll wait your reply

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 ,
Sep 11, 2023 Sep 11, 2023

Select the whole script and run it.

ctrl-a ctrl-enter

 

 

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 ,
Sep 10, 2023 Sep 10, 2023

Did you try this...

does that open 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
Engaged ,
Sep 10, 2023 Sep 10, 2023

Sure , I tried it now again , it creates a new file called : Test (One Image Per Page).pdf

This file is exactly same as old Test.pdf

No change occures 

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 ,
Sep 10, 2023 Sep 10, 2023

No, this script:

var thePath=this.path;
var directory=thePath.substring(0,thePath.length-this.documentFileName.length);
var theFile=directory+"Test.pdf";
var otherDoc=app.openDoc(theFile);

does it open the "Tesr.pdf" 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
Engaged ,
Sep 10, 2023 Sep 10, 2023

No , I tried it now 

message appears :

ReferenceError: theFile is not defined
1:Console:Exec
undefined

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 ,
Sep 10, 2023 Sep 10, 2023

Could you open your Test.pdf file then execute "this.path" from the console window.

Capture d’écran 2023-09-10 à 21.33.15.png

You should get the path in the console window.

Capture_d’écran_2023-09-10_à_21_33_56.png

Could you send me a screenshot of the path?

@+

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
Engaged ,
Sep 10, 2023 Sep 10, 2023

Is it safe to send you full path here or send it as a private message ?

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 ,
Sep 10, 2023 Sep 10, 2023

In PM if you wish...

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
Engaged ,
Sep 10, 2023 Sep 10, 2023

I sent it in PM

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 ,
Sep 10, 2023 Sep 10, 2023

With no file open, if you execute this script with your entire path, does that open the Test.pdf file?

Capture d’écran 2023-09-10 à 22.59.10.png

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