op.document.cropPages

From PDF XChange PDF SDK
Jump to: navigation, search
(Automatic page editing by robot)
 
(Sample)
 
(10 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
{{#customTitle:op.document.cropPages}}
 
{{#customTitle:op.document.cropPages}}
 
{{#parentPage:PXV:Operations|op.document.cropPages|operation}}
 
{{#parentPage:PXV:Operations|op.document.cropPages|operation}}
{{ToWrite}}
 
 
{{ToReview}}
 
{{ToReview}}
  
 
== Overview ==
 
== Overview ==
The operation overview...
+
The operation allows to change the crop box of the document's pages.
  
 
== Parameters ==
 
== Parameters ==
Line 15: Line 14:
 
|-
 
|-
 
| class="op_param_name" | Input
 
| class="op_param_name" | Input
| style="text-align:center" | Array
+
| style="text-align:center" | IUnknown
| Array of <code>IUnknown</code>-based objects.
+
| <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] which pages will be cropped.
 
|-
 
|-
 
| class="op_param_name" | Output
 
| class="op_param_name" | Output
| style="text-align:center;" | Array
+
| style="text-align:center;" | IUnknown
| Array of <code>IUnknown</code>-based objects.
+
| <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] which pages were cropped.
 
|-
 
|-
 
| class="op_param_name" | [[PXV:op_document_cropPages_Options|Options]]
 
| class="op_param_name" | [[PXV:op_document_cropPages_Options|Options]]
Line 26: Line 25:
 
| Dictionary with options of the operation.
 
| Dictionary with options of the operation.
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//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();
 +
}
 +
</pre>

Latest revision as of 07: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();
}