I'm currently working on a feature using PDF-XChange Editor SDK v10.x (C#/.NET) and have a couple of questions regarding annotation flattening.
Background
Our application allows users to create various markup annotations (such as Line, Square, and Sticky Note annotations) as well as digital signatures. In addition to the standard annotation properties, we also store some application-specific information inside each annotation by adding custom dictionary entries through the Core API.
When the document reaches a certain workflow stage, we'd like to flatten only the visual markup annotations while keeping signatures and form fields interactive.
urrent implementation
At the moment we're using:
Code: Select all
// Flatten all annotations on the specified pages
INumArray pagesToFlatten = ...;
pEditorDoc.CoreDoc.FlattenPagesAnnotations(pagesToFlatten, null, 0);Is there a supported way to flatten only selected annotation types (for example, Line, Square, and Text/Sticky Note) while leaving Digital Signature and Widget/Form Field annotations untouched?
If selective flattening isn't supported directly, is the recommended approach to enumerate the annotations first, remove or temporarily exclude the ones that shouldn't be flattened, and then restore them afterward?
Since the original annotation objects are removed during the flattening process, any custom dictionary entries attached to those annotations are lost as well. Is there any recommended way to preserve this custom metadata? For example:
copying it to another PDF object before flattening,
storing it at the page or document level,
or using another mechanism provided by the SDK?
I checked the API reference but couldn't find any callback or overload that allows filtering annotations during the flatten operation.
If anyone has experience with this workflow or could point me toward the recommended approach (either C# or C++ examples are welcome), I'd really appreciate it.