op.document.cropPages
From PDF XChange PDF SDK
(→Sample) |
(→Sample) |
||
(One intermediate revision by the same user not shown) | |||
Line 33: | Line 33: | ||
return; | return; | ||
int nID = pInst.Str2ID("op.document.cropPages", false); | int nID = pInst.Str2ID("op.document.cropPages", false); | ||
− | PDFXEdit.IOperation | + | PDFXEdit.IOperation Op = pInst.CreateOp(nID); |
− | PDFXEdit.ICabNode input = | + | PDFXEdit.ICabNode input = Op.Params.Root["Input"]; |
input.v = pDoc; | input.v = pDoc; | ||
− | PDFXEdit.ICabNode options = | + | PDFXEdit.ICabNode options = Op.Params.Root["Options"]; |
− | options["Flags"].v = | + | options["Flags"].v = 1024 | 2048; //Remove white spaces |
− | + | Op.Do(); | |
} | } | ||
Line 46: | Line 46: | ||
return; | return; | ||
int nID = pInst.Str2ID("op.document.cropPages", false); | int nID = pInst.Str2ID("op.document.cropPages", false); | ||
− | PDFXEdit.IOperation | + | PDFXEdit.IOperation Op = pInst.CreateOp(nID); |
− | PDFXEdit.ICabNode input = | + | PDFXEdit.ICabNode input = Op.Params.Root["Input"]; |
input.v = pDoc; | input.v = pDoc; | ||
− | PDFXEdit.ICabNode options = | + | PDFXEdit.ICabNode options = Op.Params.Root["Options"]; |
options["Flags"].v = 2; //Crop Box | options["Flags"].v = 2; //Crop Box | ||
//Specifying offsets | //Specifying offsets | ||
Line 57: | Line 57: | ||
options["CropBox.right"].v = 50; | options["CropBox.right"].v = 50; | ||
options["CropBox.bottom"].v = 50; | options["CropBox.bottom"].v = 50; | ||
− | + | Op.Do(); | |
} | } | ||
</pre> | </pre> |
Latest revision as of 06:51, 7 September 2017
Overview
The operation allows to change the crop box of the document's pages.
Parameters
Name | Type | Description |
---|---|---|
Input | IUnknown | IUnknown -based object containing the IPXC_Document which pages will be cropped.
|
Output | IUnknown | IUnknown -based object containing the IPXC_Document which pages were cropped.
|
Options | Dictionary | Dictionary with options of the operation. |
Sample
//C# private void RemoveWhiteSpaces(PDFXEdit.IPXV_Document pDoc, PDFXEdit.PXV_Inst pInst) { if (pDoc == null) return; int nID = pInst.Str2ID("op.document.cropPages", false); PDFXEdit.IOperation Op = pInst.CreateOp(nID); PDFXEdit.ICabNode input = Op.Params.Root["Input"]; input.v = pDoc; PDFXEdit.ICabNode options = Op.Params.Root["Options"]; options["Flags"].v = 1024 | 2048; //Remove white spaces Op.Do(); } private void CropByOffsets(PDFXEdit.IPXV_Document pDoc, PDFXEdit.PXV_Inst pInst) { if (pDoc == null) return; int nID = pInst.Str2ID("op.document.cropPages", false); PDFXEdit.IOperation Op = pInst.CreateOp(nID); PDFXEdit.ICabNode input = Op.Params.Root["Input"]; input.v = pDoc; PDFXEdit.ICabNode options = Op.Params.Root["Options"]; options["Flags"].v = 2; //Crop Box //Specifying offsets options["IsOffset"].v = true; options["CropBox.top"].v = 50; options["CropBox.left"].v = 50; options["CropBox.right"].v = 50; options["CropBox.bottom"].v = 50; Op.Do(); }