Skip to main content
Participant
Sep 1, 2025 4:18 AM UTC
Answered

place PDF into inDesign using SDK plugin

how to place multiple or single pdf to adoe inDesign via C++ SDK plugin. i cannot find the necssary API calls or documentation to achive this.

Rahul_RastogiCorrect answer
Inspiring
Sep 1, 2025 4:48 AM UTC

I searched the SDK but did not find any direct way to do this with single command but you can do this in two steps -  

 

1. Set the PDF Preferences indicating which page number to import, crop settings etc.

2. Load the PDF file and place it.

 

Refer the below snippets -

// PDF Preferences -

InterfacePtr<ICommand> setPDFPlacePrefsCmd(CmdUtils::CreateCommand(kSetPDFPlacePrefsCmdBoss));
InterfacePtr<IPDFPlacePrefs> iPDFPlacePrefs(setPDFPlacePrefsCmd, IID_IPDFPLACEPREFS);
// SetPage takes 1 based index
iPDFPlacePrefs->SetPage(i + 1);  // which page of pdf to import.
iPDFPlacePrefs->SetTransparentBackground(kFalse);
iPDFPlacePrefs->SetCropTo(IPDFPlacePrefs::kCropToMedia); // crop settings
CmdUtils::ProcessCommand(setPDFPlacePrefsCmd);

// place file in frame
Use the following from SDK -
SDKLayoutHelper::PlaceFileInFrame

 

I tested and I was able to place the PDF in the frame.

 

Other Solution could be - Load the PlaceGun which will load all the PDF Pages and then iterate the placegun and place the pdf pages.

 

- Rahul Rastogi

Adobe InDesign C++ Plugin Architect.

3 replies

Rahul_RastogiCorrect answer
Inspiring
Sep 1, 2025 4:48 AM UTC

I searched the SDK but did not find any direct way to do this with single command but you can do this in two steps -  

 

1. Set the PDF Preferences indicating which page number to import, crop settings etc.

2. Load the PDF file and place it.

 

Refer the below snippets -

// PDF Preferences -

InterfacePtr<ICommand> setPDFPlacePrefsCmd(CmdUtils::CreateCommand(kSetPDFPlacePrefsCmdBoss));
InterfacePtr<IPDFPlacePrefs> iPDFPlacePrefs(setPDFPlacePrefsCmd, IID_IPDFPLACEPREFS);
// SetPage takes 1 based index
iPDFPlacePrefs->SetPage(i + 1);  // which page of pdf to import.
iPDFPlacePrefs->SetTransparentBackground(kFalse);
iPDFPlacePrefs->SetCropTo(IPDFPlacePrefs::kCropToMedia); // crop settings
CmdUtils::ProcessCommand(setPDFPlacePrefsCmd);

// place file in frame
Use the following from SDK -
SDKLayoutHelper::PlaceFileInFrame

 

I tested and I was able to place the PDF in the frame.

 

Other Solution could be - Load the PlaceGun which will load all the PDF Pages and then iterate the placegun and place the pdf pages.

 

- Rahul Rastogi

Adobe InDesign C++ Plugin Architect.

Translate
Participant
Sep 1, 2025 5:53 AM UTC

thank you verry much it really worked

Translate
Participant
Sep 1, 2025 4:21 AM UTC

i'm using Adobe inDesign 2025 x64 and SDK 20.5.0.48 - july 2025

Translate