Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

opening acrobat after generating pdf

New Here ,
Aug 19, 2025 Aug 19, 2025

I'm using the following code snipped to generate pdf since a long time...

static Boolean generateHiresPdf(IDocument* document, IDFile pdfFile)
	{
	InterfacePtr<ICommand> piPDFExportCmd(CmdUtils::CreateCommand(kPDFExportCmdBoss));
	ASSERT(piPDFExportCmd); if (!piPDFExportCmd) return FALSE;

	InterfacePtr<IPDFExportPrefs> piPDFExportPrefs(piPDFExportCmd, UseDefaultIID());
	ASSERT(piPDFExportPrefs); if (!piPDFExportPrefs) return FALSE;

....

    InterfacePtr<ISysFileData> piFileData(piPDFExportCmd, UseDefaultIID());
	ASSERT(piFileData); if (!piFileData) return FALSE;
	piFileData->Set(pdfFile);

	InterfacePtr<IPageList> pageList(document, UseDefaultIID());
	ASSERT(pageList); if (!pageList) return FALSE;

	UIDList pagesUIDList(::GetDataBase(document));
	int32 numPages = pageList->GetPageCount();
	for (int32 i = 0; i < numPages; i++)
		pagesUIDList.Append(pageList->GetNthPageUID(i));

	InterfacePtr<IOutputPages> piOutputPages(piPDFExportCmd, UseDefaultIID());
	ASSERT(piOutputPages); if (!piOutputPages) return FALSE;

	piOutputPages->InitializeFrom(pagesUIDList, kFalse);
	K2::scoped_ptr<RangeProgressBar> deleteProgressBar;
	bool16 bShowImmediate = kTrue;
	RangeProgressBar* progress = new RangeProgressBar("das PDF wird erzeugt...", 0, numPages, bShowImmediate, kTrue, nil, kTrue);
	piPDFExportPrefs->SetProgress(progress);
	deleteProgressBar.reset(progress);

	// and action please
	Boolean ret = (CmdUtils::ProcessCommand(piPDFExportCmd) == kSuccess);

Now some customers want to open Acrobat with this new generated pdf if this flag is set in Indesign. 

 // so far so good, now we reading the flag for opening acrobat or not
	InterfacePtr<IPDFPostProcessPrefs>  appPostProcessPrefs((IPDFPostProcessPrefs*)::QuerySessionPreferences(IID_IPDFPOSTPROCESSPREFS));
	ASSERT(appPostProcessPrefs); if (!appPostProcessPrefs) return ret;
	if (appPostProcessPrefs->GetViewAfterExport()) 
	{
	
	    //??
	}

 

But I have no idea to do that. At the moment i use 

#if MACOS
...
#else

		ShellExecute(GetIndesignMainWnd(), 0, pdfFile.GrabTString(), 0, 0, SW_SHOW);
#endif
	}

but this is platform dependent. Any idea to to that with the sdk?

thx Holger

 

TOPICS
SDK
133
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2025 Aug 20, 2025

Hi @Holger5C5C ,

well, one method would be to execute the written PDF file.

With ExtendScript this could be easy as this, on macOS and on Windows:

// ExtendScript:
pdfFile.execute();

Provided that PDF files will be opened by Acrobat if double-clicked, of course.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 22, 2025 Aug 22, 2025
LATEST

There are two methods that can open the PDF after export.

IPDFExportPrefs::SetPDFExLaunchAcrobat

IPDFPostProcessPrefs::SetViewAfterExport 

-Manan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines