Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
There are two methods that can open the PDF after export.
IPDFExportPrefs::SetPDFExLaunchAcrobat
IPDFPostProcessPrefs::SetViewAfterExport
-Manan
Find more inspiration, events, and resources on the new Adobe Community
Explore Now