Copy link to clipboard
Copied
Does someone have the list (or could tell me where to find it) of all the supported formats of the IExportProvider?
I only found the InCopyMarkup and InCopyInterchange but I need the InDesign Markup Language.
I also try
PMString icDocumentFormatName("InDesign Markup (IDML)");
PMString icDocumentFormatName3("InDesignMarkup");
PMString icDocumentFormatName4("InDesignMarkup (IDML)");
PMString icDocumentFormatName5("InDesignMarkupLanguage");
PMString icDocumentFormatName6("InDesign Markup Language");
PMString icDocumentFormatName7("IDML");
PMString icDocumentFileExtension (f.GetExtensionForFormatName(icDocumentFormatName));
PMString icDocumentFileExtension3 (f.GetExtensionForFormatName(icDocumentFormatName3));
PMString icDocumentFileExtension4 (f.GetExtensionForFormatName(icDocumentFormatName4));
PMString icDocumentFileExtension5 (f.GetExtensionForFormatName(icDocumentFormatName5));
PMString icDocumentFileExtension6 (f.GetExtensionForFormatName(icDocumentFormatName6));
PMString icDocumentFileExtension7 (f.GetExtensionForFormatName(icDocumentFormatName7));
but all return an empty string.
With more investigation I found What I had wrong
this is the solution that Implemented for this (SDK for CS5 and CS55 because CS6 can be solved with Manan answer):
IDocument* frontDoc = Utils<ILayoutUIUtils>()->GetFrontDocument();
PMString formatName("InDesignMarkup");
InterfacePtr<IK2ServiceRegistry> iK2ServiceRegistry(GetExecutionContextSession(),UseDefaultIID());
if(!iK2ServiceRegistry)
...
Copy link to clipboard
Copied
I am using formatName("InDesignMarkup"), it works fine to export idml file.
Copy link to clipboard
Copied
Hi, I have other question related to the IExportProvider.
When I use the kSuppressUI in the function ExportToFile from IExportProvider the file is not save in the specified path.
I don't want to use the kFullUI option because is an automated process that need to export the file to idml (the kFullUI launch a pop up that request to save the file).
What did you do after the ExportToFile? Thanks in advance
Copy link to clipboard
Copied
I am using kSuppressUI in IExportProvider::ExportToFile, it works.
Copy link to clipboard
Copied
Look at Re: IDocFileHandler SaveACopy as idml i have given an working example that works fine with the suppressed UI. Without looking at your code or more information as to what of you mean by not saving at the specified path, its difficult to provide hints that may solve your issue.
-Manan
Copy link to clipboard
Copied
With more investigation I found What I had wrong
this is the solution that Implemented for this (SDK for CS5 and CS55 because CS6 can be solved with Manan answer):
IDocument* frontDoc = Utils<ILayoutUIUtils>()->GetFrontDocument();
PMString formatName("InDesignMarkup");
InterfacePtr<IK2ServiceRegistry> iK2ServiceRegistry(GetExecutionContextSession(),UseDefaultIID());
if(!iK2ServiceRegistry)
return;
//look for all service providers with kExportProviderService
int32 exportProviderCount = iK2ServiceRegistry->GetServiceProviderCount(kExportProviderService);
//Iterate through them
bool found = kFalse;
for (int32 exportProviderIndex = 0; exportProviderIndex < exportProviderCount; exportProviderIndex++) {
//get the service provider boss class
InterfacePtr<IK2ServiceProvider> iK2ServiceProvider(iK2ServiceRegistry ->QueryNthServiceProvider(kExportProviderService, exportProviderIndex));
//get the export provider implementation itself
InterfacePtr<IExportProvider> exportProvider (iK2ServiceProvider,IID_IEXPORTPROVIDER);
//Check to see if the current selecction specifier can be exporter by this provider
bool16 canExportByTarget = exportProvider->CanExportThisFormat(frontDoc, nil, formatName);
if (canExportByTarget) {
found=kTrue;
IDFile dest(WideString("path and name of the new file location.idml"));
exportProvider->ExportToFile(dest, frontDoc, nil, formatName, kSuppressUI);
}
if (found) {
break;
}
}
Copy link to clipboard
Copied
Sorry i was a bit busy so could not respond back, but the code that you wrote should work in all versions of InDesign supporting IDML export. So the basic difference vis a vis my code, is that i was using a specific export service provider class for the IDML export while your code looks for the first available service provider that can handle the format. So your code is bound to work on all versions of InDesign that has atleast one IDML export provider.
-Manan