Copy link to clipboard
Copied
Hi All,
In my plugin I need to export active document to png file with specific options. And sometimes I need to export definite pages from the document, but not all.
In standard UI of InDesign there are several basic steps of export:
1."File"->"Export";
2. Choose the location and filename to export to;
3. Customize export options.
In my plugin I need to have the possibility to set options from 2 and 3 steps.
I have found out that there are some bosses, which deal with PNG:
kPNGErrorStringServiceBoss
kPNGExportCommandBoss
kPNGExportPrefsScriptProviderBoss
kPNGExportProviderBoss
kPNGExportSetPrefsCommandBoss
kPNGExportUIDialogBoss
kPNGFilterConversionBoss
kPNGIconButtonWidgetBoss
kPNGImageReadFormatBoss
kPNGImageWriteFormatBoss
kPNGPrefsDialogBoss
Also, there are some interfaces and widget id's in the following headers "PNGFilterUIID.h", "PNGPrefsUIID.h", "PNGFilterID.h", which deal with png export process.
One of the ways to solve my problem is to create png export dialog (maybe IDialogMgr::CreateNewDialog), iterate over all widgets and set necessary values, but I don't know how to create this ExportDialog.
Any ideas how to solve this are of great value.
Thanks in advance.
The sollution is the following:
1. Make an AddIn to kDocBoss with new interface e.x. IExportToPNG
2. In implementation of IExportToPNG, use SnapshotUtilsEx.
P.S.
The right order of using SnapshotUtilsEx is:
1. Use constructor of SnapshotUtilsEx(...)
2. SnapshotUtilsEx::Draw(...)
3. SnapshotUtilsEx::ExportImageToPNG(...)
Regards!
Copy link to clipboard
Copied
Have a look at the Basic Dialog sample.
P.
Copy link to clipboard
Copied
I have already tried this method from the SDK example:
// Load the plug-in's resource.
PMLocaleId nLocale = LocaleSetting::GetLocale();
RsrcSpec dialogSpec
(
nLocale, // Locale index from PMLocaleIDs.h.
kBscDlgPluginID, // Our Plug-in ID from BasicDialogID.h.
kViewRsrcType, // This is the kViewRsrcType.
kSDKDefDialogResourceID, // Resource ID for our dialog.
kTrue // Initially visible.
);
// CreateNewDialog takes the dialogSpec created above, and also
// the type of dialog being created (kMovableModal).
IDialog* dialog = dialogMgr->CreateNewDialog(dialogSpec, IDialog::kMovableModal);
if (dialog == nil)
{
ASSERT_FAIL("BscDlgActionComponent::DoDialog: can't create dialog");
break;
}
When I use kSDKDefDialogResourceID, it creates dialog, which was defined in my plugin resource file not a standard export dialog
What shoul I use instead kBscDlgPluginID and kSDKDefDialogResourceID?
Copy link to clipboard
Copied
The sollution is the following:
1. Make an AddIn to kDocBoss with new interface e.x. IExportToPNG
2. In implementation of IExportToPNG, use SnapshotUtilsEx.
P.S.
The right order of using SnapshotUtilsEx is:
1. Use constructor of SnapshotUtilsEx(...)
2. SnapshotUtilsEx::Draw(...)
3. SnapshotUtilsEx::ExportImageToPNG(...)
Regards!