2 Replies Latest reply on Jun 21, 2015 4:52 AM by mmm064

    How to use the Photoshop PDFSaveOptions.presetFile property?

    mmm064 Level 1

      Hi,

       

      Hopefully this is a relatively simple question for someone - as I'm new to scripting in Adobe Photoshop.

       

      I'm trying to retrieve the PDR Presets using the PDFSaveOptions.presetFile property, rather than setting all of the PDFSaveOptions properties one by one. I'm scripting in Javascript using Photoshop CC 2014 with ExtendScript Toolkit.

       

      In the Photoshop Scriptref_js.pdf on page 149 it indicates that this property will override other settings which is exactly what I want it to do.

       

      Unfortunately this doesn't seem to work for me. 


      The property is read/write and I can set the value to match the PDF Preset e.g. PDFSaveOptions.presetFile = "Press Quality" and I can read the value back.  However, all of the other values (such as  jpegQuality) are not set and I get an error when I attempt to read them.

       

      Does any one have a simple example of how to use this feature?

       

      Many thanks,

      Mark

        • 1. Re: How to use the Photoshop PDFSaveOptions.presetFile property?
          Philip Cord Level 4

          I don't think you can access those values via scripting, but you can save the preset out to a file, then rename it to a text file and then view it.

          Here is an example of "Press Quality"

          <<
            /ASCII85EncodePages false
            /AllowPSXObjects false
            /AllowTransparency false
            /AlwaysEmbed [
              true
            ]
            /AntiAliasColorImages false
            /AntiAliasGrayImages false
            /AntiAliasMonoImages false
            /AutoFilterColorImages false
            /AutoFilterGrayImages true
            /AutoPositionEPSFiles true
            /AutoRotatePages /All
            /Binding /Left
            /CalCMYKProfile (U.S. Web Coated \050SWOP\051 v2)
            /CalGrayProfile (Dot Gain 20%)
            /CalRGBProfile (sRGB IEC61966-2.1)
            /CannotEmbedFontPolicy /Warning
            /CheckCompliance [
              /None
            ]
            /ColorACSImageDict <<
              /HSamples [
                1
                1
                1
                1
              ]
              /QFactor 0.15000
              /VSamples [
                1
                1
                1
                1
              ]
            >>
            /ColorConversionStrategy /LeaveColorUnchanged
            /ColorImageAutoFilterStrategy /JPEG
            /ColorImageDepth -1
            /ColorImageDict <<
              /HSamples [
                1
                1
                1
                1
              ]
              /QFactor 0.15000
              /VSamples [
                1
                1
                1
                1
              ]
            >>
            /ColorImageDownsampleThreshold 1.50000
            /ColorImageDownsampleType /Bicubic
            /ColorImageFilter /DCTEncode
            /ColorImageMinDownsampleDepth 1
            /ColorImageMinResolution 300
            /ColorImageMinResolutionPolicy /OK
            /ColorImageResolution 300
            /ColorSettingsFile ()
            /CompatibilityLevel 1.4
            /CompressObjects /Tags
            /CompressPages true
            /ConvertImagesToIndexed true
            /CreateJDFFile false
            /CreateJobTicket false
            /CropColorImages true
            /CropGrayImages true
            /CropMonoImages true
            /DSCReportingLevel 0
            /DefaultRenderingIntent /Default
            /Description <<
              /ENU (Use these settings to create Adobe PDF documents for quality printing on desktop printers and proofers.  Created PDF documents can be opened with Acrobat and Adobe Reader 5.0 and later.)
            >>
            /DetectBlends true
            /DetectCurves 0
            /DoThumbnails false
            /DownsampleColorImages true
            /DownsampleGrayImages true
            /DownsampleMonoImages true
            /EmbedAllFonts true
            /EmbedJobOptions false
            /EmbedOpenType false
            /EmitDSCWarnings false
            /EncodeColorImages true
            /EncodeGrayImages true
            /EncodeMonoImages true
            /EndPage -1
            /GrayACSImageDict <<
              /HSamples [
                1
                1
                1
                1
              ]
              /QFactor 0.15000
              /VSamples [
                1
                1
                1
                1
              ]
            >>
            /GrayImageAutoFilterStrategy /JPEG
            /GrayImageDepth -1
            /GrayImageDict <<
              /HSamples [
                1
                1
                1
                1
              ]
              /QFactor 0.15000
              /VSamples [
                1
                1
                1
                1
              ]
            >>
            /GrayImageDownsampleThreshold 1.50000
            /GrayImageDownsampleType /Bicubic
            /GrayImageFilter /DCTEncode
            /GrayImageMinDownsampleDepth 2
            /GrayImageMinResolution 300
            /GrayImageMinResolutionPolicy /OK
            /GrayImageResolution 300
            /ImageMemory 1048576
            /JPEG2000ColorACSImageDict <<
              /Quality 30
              /TileHeight 256
              /TileWidth 256
            >>
            /JPEG2000ColorImageDict <<
              /Quality 30
              /TileHeight 256
              /TileWidth 256
            >>
            /JPEG2000GrayACSImageDict <<
              /Quality 30
              /TileHeight 256
              /TileWidth 256
            >>
            /JPEG2000GrayImageDict <<
              /Quality 30
              /TileHeight 256
              /TileWidth 256
            >>
            /LockDistillerParams false
            /MaxSubsetPct 100
            /MonoImageDepth -1
            /MonoImageDict <<
              /K -1
            >>
            /MonoImageDownsampleThreshold 1.50000
            /MonoImageDownsampleType /Bicubic
            /MonoImageFilter /CCITTFaxEncode
            /MonoImageMinResolution 1200
            /MonoImageMinResolutionPolicy /OK
            /MonoImageResolution 1200
            /Namespace [
              (Adobe)
              (Common)
              (1.0)
            ]
            /NeverEmbed [
              true
            ]
            /OPM 1
            /Optimize true
            /OtherNamespaces [
              <<
                /AsReaderSpreads false
                /CropImagesToFrames true
                /ErrorControl /WarnAndContinue
                /FlattenerIgnoreSpreadOverrides false
                /IncludeGuidesGrids false
                /IncludeNonPrinting false
                /IncludeSlug false
                /Namespace [
                  (Adobe)
                  (InDesign)
                  (4.0)
                ]
                /OmitPlacedBitmaps false
                /OmitPlacedEPS false
                /OmitPlacedPDF false
                /SimulateOverprint /Legacy
              >>
              <<
                /AddBleedMarks false
                /AddColorBars false
                /AddCropMarks false
                /AddPageInfo false
                /AddRegMarks false
                /BleedOffset [
                  0
                  0
                  0
                  0
                ]
                /ConvertColors /NoConversion
                /DestinationProfileName (sRGB IEC61966-2.1)
                /DestinationProfileSelector /NA
                /Downsample16BitImages true
                /FlattenerPreset <<
                  /PresetSelector /MediumResolution
                >>
                /FormElements false
                /GenerateStructure true
                /IncludeBookmarks false
                /IncludeHyperlinks false
                /IncludeInteractive false
                /IncludeLayers false
                /IncludeProfiles true
                /MarksOffset 6
                /MarksWeight 0.25000
                /MultimediaHandling /UseObjectSettings
                /Namespace [
                  (Adobe)
                  (CreativeSuite)
                  (2.0)
                ]
                /PDFXOutputIntentProfileSelector /NA
                /PageMarksFile /RomanDefault
                /PreserveEditing true
                /UntaggedCMYKHandling /LeaveUntagged
                /UntaggedRGBHandling /LeaveUntagged
                /UseDocumentBleed false
              >>
              <<
                /AllowImageBreaks true
                /AllowTableBreaks true
                /ExpandPage false
                /HonorBaseURL true
                /HonorRolloverEffect false
                /IgnoreHTMLPageBreaks false
                /IncludeHeaderFooter false
                /MarginOffset [
                  0
                  0
                  0
                  0
                ]
                /MetadataAuthor ()
                /MetadataKeywords ()
                /MetadataSubject ()
                /MetadataTitle ()
                /MetricPageSize [
                  0
                  0
                ]
                /MetricUnit /inch
                /MobileCompatible 0
                /Namespace [
                  (Adobe)
                  (GoLive)
                  (8.0)
                ]
                /OpenZoomToHTMLFontSize false
                /PageOrientation /Portrait
                /RemoveBackground false
                /ShrinkContent true
                /TreatColorsAs /MainMonitorColors
                /UseEmbeddedProfiles false
                /UseHTMLTitleAsMetadata true
              >>
            ]
            /PDFX1aCheck false
            /PDFX3Check false
            /PDFXBleedBoxToTrimBoxOffset [
              0
              0
              0
              0
            ]
            /PDFXCompliantPDFOnly false
            /PDFXNoTrimBoxError true
            /PDFXOutputCondition ()
            /PDFXOutputConditionIdentifier ()
            /PDFXOutputIntentProfile ()
            /PDFXRegistryName ()
            /PDFXSetBleedBoxToMediaBox true
            /PDFXTrapped /False
            /PDFXTrimBoxToMediaBoxOffset [
              0
              0
              0
              0
            ]
            /ParseDSCComments true
            /ParseDSCCommentsForDocInfo true
            /ParseICCProfilesInComments true
            /PassThroughJPEGImages true
            /PreserveCopyPage true
            /PreserveDICMYKValues true
            /PreserveEPSInfo true
            /PreserveFlatness true
            /PreserveHalftoneInfo false
            /PreserveOPIComments false
            /PreserveOverprintSettings true
            /StartPage 1
            /SubsetFonts true
            /TransferFunctionInfo /Apply
            /UCRandBGInfo /Preserve
            /UsePrologue false
            /sRGBProfile (sRGB IEC61966-2.1)
          >> setdistillerparams
          <<
            /HWResolution [2400 2400]
            /PageSize [612.000 792.000]
          >> setpagedevice
          
          
          • 2. Re: How to use the Photoshop PDFSaveOptions.presetFile property?
            mmm064 Level 1

            Thanks for your reply Philip,

             

            I can see the approach will work, but I think (for me) the amount of code I'd write would be significant in order to isolate the 10 or 12 tags I'd need for Photoshop.  From what I understand, these PDF Presets are shared across the entire Adobe suite and they contain information that Photoshop wouldn't use. 

             

            In the end, I just created a function that replicated just key values of each of the presets that I needed and returned the values based a Script UI dropdown box.

             

            Hopefully, there'll be better documentation in the CC 2015 reference guides.

             

            Mark