Skip to main content
Inspiring
July 18, 2023
Question

Create Package with PDF preset options

  • July 18, 2023
  • 2 replies
  • 304 views

I want to create package with PDF preset options in SDK.

I get the package interface <IS4SPPackage>
then I set the pdfFlag - pakckage->SetCreatePDFFlag(kTrue);
but I didn't get any method to set the PDF Preset option.

 

When I creating the packages manually then I am getting the option of PDF preset (See the attached image)  and I want the same in SDK plugin

 

 

This topic has been closed for replies.

2 replies

Inspiring
July 19, 2023

I was not able to find any direct Interface for setting the PDF Preset for Packaging, but the following code snippet worked -

 

InterfacePtr<IStringData> iLastPDFStyleUsedStringData(iDocWorkspace, IID_IPDFEXPORTSTYLELASTUSED);
iLastPDFStyleUsedStringData->Set(strPDFPresetUIName);
 
First set the PDF Preset as above then perform packaging enable the PDF export.
 
Regards,
Rahul Rastogi
Adobe InDesign C++ Plugin Developer
Community Expert
July 18, 2023

I'm not an expert - only a beginner - and try my hat at this maybe it will help maybe it won't - I'll probably be corrected

I'd imagine you'd need a IS4PDFExportPresetCmdData line... but again I'm not 100% sure

#include "IS4PDFExportPresetCmdData.h"

// Assuming you already have the IS4SPPackage interface in "myPackage" variable.
// Get the PDF export settings from the package:
IDocument* packageDoc = myPackage->GetDocument();
InterfacePtr<IS4PDFExportPresetCmdData> pdfPresetData(packageDoc, UseDefaultIID());
if (pdfPresetData) {
    // Set the PDF preset by name (replace "YourPresetName" with the actual preset name you created manually):
    pdfPresetData->SetPresetName("YourPresetName");
}