IPXV_ContentItemsSelection Interface

From PDF XChange PDF SDK
Jump to: navigation, search
m (Automatic page editing by robot)
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
__NOTOC__
 
[[Category:Editor]]
 
[[Category:Editor]]
 
{{#customTitle:IPXV_ContentItemsSelection Interface}}
 
{{#customTitle:IPXV_ContentItemsSelection Interface}}
 +
{{#parentPage:PXV:PXV_Interfaces|IPXV_ContentItemsSelection|interface}}
 +
{{ToWrite}}
 +
{{ToReview}}
  
 
The interface of object of PDF-XChange Editor SDK.
 
The interface of object of PDF-XChange Editor SDK.
Line 7: Line 11:
  
 
== Methods ==
 
== Methods ==
{| class="wikitable sortable collapsible" style="width: 100%"
+
{| class="wikitable methods"
|-
+
! style="text-align: left" scope="col" width="15%" | Method
+
! style="text-align: left" scope="col" class="unsortable" | Description
+
 
|-
 
|-
 
| [[PXV:IPXV_ContentItemsSelection_GetSel|GetSel]]
 
| [[PXV:IPXV_ContentItemsSelection_GetSel|GetSel]]
| ...
 
|-
 
 
| [[PXV:IPXV_ContentItemsSelection_RemoveSel|RemoveSel]]
 
| [[PXV:IPXV_ContentItemsSelection_RemoveSel|RemoveSel]]
| ...
 
|-
 
 
| [[PXV:IPXV_ContentItemsSelection_UpdateSel|UpdateSel]]
 
| [[PXV:IPXV_ContentItemsSelection_UpdateSel|UpdateSel]]
| ...
+
|  
 
|}
 
|}
  
 
== Properties ==
 
== Properties ==
{| style="width: 100%" class="wikitable sortable collapsible"
+
{| class="wikitable properties"
|-
+
! style="text-align: left" scope="col" width="15%" | Property
+
! style="text-align: center" scope="col" width="5%" | Access Type
+
! style="text-align: left" scope="col"  class="unsortable" | Description
+
 
|-
 
|-
 +
| [[PXV:IPXV_ContentItemsSelection__NewEnum|_NewEnum]]
 
| [[PXV:IPXV_ContentItemsSelection_Count|Count]]
 
| [[PXV:IPXV_ContentItemsSelection_Count|Count]]
| style="text-align: center" | R
 
| .
 
|-
 
 
| [[PXV:IPXV_ContentItemsSelection_Item|Item]]
 
| [[PXV:IPXV_ContentItemsSelection_Item|Item]]
| style="text-align: center" | R
+
|  
| .
+
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
private void SetContentColor(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
 +
{
 +
if (Doc == null)
 +
return;
 +
//Creating contentItems.setProps operation
 +
int nID = Inst.Str2ID("op.contentItems.setProps", false);
 +
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
 +
var input = Op.Params.Root["Input"];
 +
input.Add().v = Doc.CoreDoc;
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
int nSelID = Inst.Str2ID("selection.contentItems", false);
 +
uint nPage = 0; //Page number that will have it's content items modified
 +
//First we need to create content items selection
 +
PDFXEdit.IPXV_ContentItemsSelection itSel = (PDFXEdit.IPXV_ContentItemsSelection)Doc.CreateStdSel((uint)nSelID);
 +
//Then we need to get root item entry for the desired page (we'll create it if needed)
 +
PDFXEdit.IPXV_ContentItemEntry itEntry = itSel.GetSel(nPage, true);
 +
//Inserting needed content items from the page
 +
var content = Doc.CoreDoc.Pages[nPage].GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_WeakClone);
 +
for (uint i = 0; i < content.Items.Count; i++)
 +
{
 +
//For example we will take all of the text items
 +
if (content.Items[i].Type == PDFXEdit.PXC_CIType.CIT_Text)
 +
itEntry.Insert(i);
 +
}
 +
//Adding selected page's root entry with added content items to the operation
 +
options["Entries"].Add(PDFXEdit.CabDataTypeID.dt_IUnknown).v = itEntry;
 +
//Setting the color (note that rgb notation is rgb(r,g,b) where r g b are float values from 0.0 to 1.0)
 +
options["FColor"].v = "#AC3312";
 +
//Setting mask that will tell the operation that the FColor will be modified
 +
options["Mask"].v = 2;
 +
Op.Do();
 +
//Clearing the selection
 +
itSel.Clear();
 +
}
 +
</pre>

Latest revision as of 02:32, 22 April 2016


The interface of object of PDF-XChange Editor SDK.

IPXV_ContentItemsSelection extends IPXV_DocSelection interface.

Methods

GetSel RemoveSel UpdateSel

Properties

_NewEnum Count Item

Sample

//C#
private void SetContentColor(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	if (Doc == null)
		return;
	//Creating contentItems.setProps operation
	int nID = Inst.Str2ID("op.contentItems.setProps", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	var input = Op.Params.Root["Input"];
	input.Add().v = Doc.CoreDoc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	int nSelID = Inst.Str2ID("selection.contentItems", false);
	uint nPage = 0; //Page number that will have it's content items modified
	//First we need to create content items selection
	PDFXEdit.IPXV_ContentItemsSelection itSel = (PDFXEdit.IPXV_ContentItemsSelection)Doc.CreateStdSel((uint)nSelID);
	//Then we need to get root item entry for the desired page (we'll create it if needed)
	PDFXEdit.IPXV_ContentItemEntry itEntry = itSel.GetSel(nPage, true);
	//Inserting needed content items from the page
	var content = Doc.CoreDoc.Pages[nPage].GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_WeakClone);
	for (uint i = 0; i < content.Items.Count; i++)
	{
		//For example we will take all of the text items
		if (content.Items[i].Type == PDFXEdit.PXC_CIType.CIT_Text)
			itEntry.Insert(i);
	}
	//Adding selected page's root entry with added content items to the operation
	options["Entries"].Add(PDFXEdit.CabDataTypeID.dt_IUnknown).v = itEntry;
	//Setting the color (note that rgb notation is rgb(r,g,b) where r g b are float values from 0.0 to 1.0)
	options["FColor"].v = "#AC3312";
	//Setting mask that will tell the operation that the FColor will be modified
	options["Mask"].v = 2;
	Op.Do();
	//Clearing the selection
	itSel.Clear();
}