Skip to main content
Participant
September 1, 2025
Answered

place PDF into inDesign using SDK plugin

  • September 1, 2025
  • 2 replies
  • 288 views

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.

Correct answer Rahul_Rastogi

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.

2 replies

Rahul_RastogiCorrect answer
Inspiring
September 1, 2025

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.

Participant
September 1, 2025

thank you verry much it really worked

Participant
September 1, 2025

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