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

make the pdf presentation with unsaved open document

Community Beginner ,
Aug 04, 2019 Aug 04, 2019

Copy link to clipboard

Copied

Hi all,

how to make the pdf presentation with unsaved open document ? below code only work for saved document with file path

//

var inputFiles =[];  
for(var a =0;a< app.documents.length;a++){ 
  inputFiles
.push(app.documents[a].fullName); 
  
} 
var outputFile = File("~/Desktop/JavaScriptPresentation.pdf");  
var options = new PresentationOptions; 
options
.presentation = true;  
options
.view = true; 
options
.autoAdvance = true;  
options
.interval = 5;  
options
.loop = true;  
options
.transition = TransitionType.RANDOM; 
app
.makePDFPresentation(inputFiles, outputFile, options);  
alert
("Presentation file saved to: \n" + outputFile.fsName);

//

TOPICS
Actions and scripting

Views

836

Translate

Translate

Report

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

correct answers 1 Correct answer

People's Champ , Aug 06, 2019 Aug 06, 2019

For any open documents, use an AM code like this.

var d = new ActionDescriptor();

var list = new ActionList();

for(var a=0;a<app.documents.length;a++) list.putString(app.documents.name);

d.putList(stringIDToTypeID("filesList"), list);

d.putPath(stringIDToTypeID("to"), new File("~/Desktop/JavaScriptPresentation.pdf"));

d.putBoolean(stringIDToTypeID("includeAnnotations"), true);

d.putEnumerated(stringIDToTypeID("backgroundColor"), stringIDToTypeID("backgroundColor"), stringIDToTypeID("white"));

d.putBoole

...

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 05, 2019 Aug 05, 2019

Copy link to clipboard

Copied

That code is using open document's backing files to create the inputFiles array.  New document that have not been saved do not have a baking file. I would also think if all open document have been saved if any have unsaved changes the PDF Presentation created would not contain the unsaved image changes. So you may be better off doing a saved before getting the backing files path you would need to do a Save As for Unsaved document you would need to have some default folder to save them into.

JJMack

Votes

Translate

Translate

Report

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 Beginner ,
Aug 05, 2019 Aug 05, 2019

Copy link to clipboard

Copied

if do like this way will take more time to save the pdf ? because need proceed heavy file like A1 A0 size, no other way just add the open document and save to pdf ?

Votes

Translate

Translate

Report

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 ,
Aug 05, 2019 Aug 05, 2019

Copy link to clipboard

Copied

There is no way to add open document that have not been save to a PDF Presentation.  Photoshop Automate PDF Presentation  creates the PDF Presentation using source image files. Photoshop can  add any open document backing file to the PDF Presentation File list.  New Documents that have not been saved have no backing file on disk. One has not been written Photoshop edits documents not files.  So if you have new open documents that have not been saved you need to save them before you can create a PDF Presentation the the open document content..  Open Document that were open from a file or have been saved  do not need to be saved.  The File on disk can  be used. However the  Open Document may have un-saved changes in Photoshop.  Those changes will not be in  the PDF Presentation if you do not save them before creating the PDF presentation.

JJMack

Votes

Translate

Translate

Report

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 Beginner ,
Aug 05, 2019 Aug 05, 2019

Copy link to clipboard

Copied

ok i see , thks!

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 06, 2019 Aug 06, 2019

Copy link to clipboard

Copied

For any open documents, use an AM code like this.

var d = new ActionDescriptor();

var list = new ActionList();

for(var a=0;a<app.documents.length;a++) list.putString(app.documents.name);

d.putList(stringIDToTypeID("filesList"), list);

d.putPath(stringIDToTypeID("to"), new File("~/Desktop/JavaScriptPresentation.pdf"));

d.putBoolean(stringIDToTypeID("includeAnnotations"), true);

d.putEnumerated(stringIDToTypeID("backgroundColor"), stringIDToTypeID("backgroundColor"), stringIDToTypeID("white"));

d.putBoolean(stringIDToTypeID("autoAdvance"), true);

d.putInteger(stringIDToTypeID("autoAdvanceSeconds"), 5);

d.putBoolean(stringIDToTypeID("loop"), true);

d.putEnumerated(stringIDToTypeID("transition"), stringIDToTypeID("transition"), stringIDToTypeID("random"));

d.putBoolean(stringIDToTypeID("presentation"), true);

var d1 = new ActionDescriptor();

d1.putString(stringIDToTypeID("pdfPresetFilename"), "High Quality Print");

d1.putBoolean(stringIDToTypeID("pdfPreserveEditing"), false);

d1.putBoolean(stringIDToTypeID("pdfViewAfterSave"), true);

d1.putInteger(stringIDToTypeID("pdfCompressionType"), 7);

d.putObject(stringIDToTypeID("as"), stringIDToTypeID("photoshopPDFFormat"), d1);

executeAction(stringIDToTypeID("PDFExport"), d, DialogModes.NO);

Votes

Translate

Translate

Report

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 Beginner ,
Aug 06, 2019 Aug 06, 2019

Copy link to clipboard

Copied

thks!this code really work

Votes

Translate

Translate

Report

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
Advisor ,
Dec 08, 2021 Dec 08, 2021

Copy link to clipboard

Copied

@r-binor anyone that knows..

Why doesn't this work if there's only a single document opened?

var list = new ActionList();

for(var a=0;a<app.documents.length;a++) list.putString(app.documents.name);

d.putList(stringIDToTypeID("filesList"), list);

 

 

Redards,

Mike

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 08, 2021 Dec 08, 2021

Copy link to clipboard

Copied

app.documents[a].name

Votes

Translate

Translate

Report

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
Advisor ,
Dec 08, 2021 Dec 08, 2021

Copy link to clipboard

Copied

Hello @Kukurykus,

 

I see that in the original code posted by @r-bin but the code I'm running has it like. this and it doesn't work on a single opened document...

 

var openFileList = new ActionList();

for(var a=0;a<app.documents.length;a++) openFileList.putString(app.documents[a].name);

presentationOpts.putList(stringIDToTypeID("filesList"), openFileList);

 

 

Regards,

Mike

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 08, 2021 Dec 08, 2021

Copy link to clipboard

Copied

No, you don't see it in original code: [a]

Votes

Translate

Translate

Report

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
Advisor ,
Dec 08, 2021 Dec 08, 2021

Copy link to clipboard

Copied

Hello @Kukurykus,

 

Sorry you misunderstood, I realize it wasn't in the original code posted but the code I'm running has it setup with [a] and it doesn't work with a single onened document.

 

Regards,

Mike

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 09, 2021 Dec 09, 2021

Copy link to clipboard

Copied

LATEST

You mean it doesn't work for one document, but for more it does? For me it does for one too.

Votes

Translate

Translate

Report

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 ,
Aug 06, 2019 Aug 06, 2019

Copy link to clipboard

Copied

It look like r-bin code works open documents un-saved and saved.  The only thing I found is the export to PDF presentation seems the resize images based on the current  resolution setting and will fail to do files the would resize too large.  It seems to resize open images like Place resizes  image files when rendering pixels for smart objects layers.

Capture.jpg

JJMack

Votes

Translate

Translate

Report

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