op.annots.flatten
From PDF XChange PDF SDK
(→Sample) |
|||
Line 30: | Line 30: | ||
private void FlattenSquareAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) | private void FlattenSquareAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) | ||
{ | { | ||
− | PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst) | + | PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS"); |
uint nSquareAtom = pSInt.StrToAtom("Square"); | uint nSquareAtom = pSInt.StrToAtom("Square"); | ||
− | int nID = | + | int nID = Inst.Str2ID("op.annots.flatten", false); |
− | PDFXEdit.IOperation Op = | + | PDFXEdit.IOperation Op = Inst.CreateOp(nID); |
PDFXEdit.ICabNode input = Op.Params.Root["Input"]; | PDFXEdit.ICabNode input = Op.Params.Root["Input"]; | ||
//Filling the operation with the annotations that need to be flatten | //Filling the operation with the annotations that need to be flatten | ||
Line 60: | Line 60: | ||
private void FlattenAllAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) | private void FlattenAllAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) | ||
{ | { | ||
− | PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst) | + | PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS"); |
uint nSquareAtom = pSInt.StrToAtom("Square"); | uint nSquareAtom = pSInt.StrToAtom("Square"); | ||
− | int nID = | + | int nID = Inst.Str2ID("op.annots.flatten", false); |
− | PDFXEdit.IOperation Op = | + | PDFXEdit.IOperation Op = Inst.CreateOp(nID); |
PDFXEdit.ICabNode input = Op.Params.Root["Input"]; | PDFXEdit.ICabNode input = Op.Params.Root["Input"]; | ||
//If we add document as an input - it means that we'll flatten all of the annotations | //If we add document as an input - it means that we'll flatten all of the annotations |
Revision as of 00:18, 2 March 2016
Overview
The operation allows to convert annotations into the pages content.
Parameters
Name | Type | Description |
---|---|---|
Input | Array | Array of IUnknown -based objects containing the IPXC_Annotation objects that need to be flattened. Also the IPXC_Document can be specified - that will mean that all of the annotations will be flattened. Note that all of the annotations must belong to one document.
|
Output | Array | Array of IUnknown -based objects containing the IPXC_Document which annotations were flattened. Not yet implemented.
|
Options | Dictionary | Dictionary with options of the operation. |
Sample
//C# private void FlattenSquareAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) { PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS"); uint nSquareAtom = pSInt.StrToAtom("Square"); int nID = Inst.Str2ID("op.annots.flatten", false); PDFXEdit.IOperation Op = Inst.CreateOp(nID); PDFXEdit.ICabNode input = Op.Params.Root["Input"]; //Filling the operation with the annotations that need to be flatten for (uint i = 0; i < Doc.CoreDoc.Pages.Count; i++) { PDFXEdit.IPXC_Page page = Doc.CoreDoc.Pages[i]; uint nCnt = page.GetAnnotsCount(); for (uint j = 0; j < nCnt; j++) { PDFXEdit.IPXC_Annotation annot = page.GetAnnot(j); //In our case it's square annotations if (annot.Type == nSquareAtom) input.Add().v = annot; } } PDFXEdit.ICabNode options = Op.Params.Root["Options"]; //Going through all of the pages options["PagesRange.Type"].v = "All"; //Flattening non-printable annotations options["NonPrintableAction"].v = "Flatten"; //Ignore form fields options["FieldsAction"].v = "LeftAsIs"; Op.Do(); } private void FlattenAllAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) { PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS"); uint nSquareAtom = pSInt.StrToAtom("Square"); int nID = Inst.Str2ID("op.annots.flatten", false); PDFXEdit.IOperation Op = Inst.CreateOp(nID); PDFXEdit.ICabNode input = Op.Params.Root["Input"]; //If we add document as an input - it means that we'll flatten all of the annotations input.Add().v = Doc; PDFXEdit.ICabNode options = Op.Params.Root["Options"]; //Going through first 3 pages options["PagesRange.Type"].v = "Exact"; options["PagesRange.Text"].v = "1-3"; //Flattening non-printable annotations options["NonPrintableAction"].v = "Flatten"; //Ignore form fields options["FieldsAction"].v = "LeftAsIs"; Op.Do(); }