Photoshop scripting: pdfSaveOpts.layers does not work
When I try save a PDF using scripts, the pdfSaveOpts.layers = false has no effect.
That is, the script saves the document as a PDF but when select the option to save withour layers, the resulting file contains all layers of the original document.
1. Version of the app: Photoshop 24.0.1
2. Platform and OS version: Windows 10 Ver. 22H2
3. Basic steps to reproduce the problem: Use the Photoshop Script Events Manager to run the script below. Photoshop Event should be Save Document
4. Expected result and actual result: The script should save a copy of the current file as a PDF with no layers. However, it saves a PDF with all layers incorporated into the PDF.
====
Here is the script I'm using:
var saveFile = File("~/Desktop/"+app.activeDocument.activeLayer.name+".pdf")
pdfSaveOpts = new PDFSaveOptions();
pdfSaveOpts.layers = false; // does not work for me
activeDocument.saveAs(saveFile, pdfSaveOpts, true);