Options

From PDF XChange PDF SDK
Jump to: navigation, search
(Automatic page editing by robot)
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
{{#customTitle:Options}}
 
{{#customTitle:Options}}
 
{{#parentPage:PXV:op_attachments_edit|Options|property}}
 
{{#parentPage:PXV:op_attachments_edit|Options|property}}
{{ToWrite}}
 
 
{{ToReview}}
 
{{ToReview}}
  
Line 14: Line 13:
 
| class="op_param_name" | Attachment
 
| class="op_param_name" | Attachment
 
| style="text-align:center" | IUnknown
 
| style="text-align:center" | IUnknown
| Specifies...
+
| Specifies the [[PXV:IPXC_FileSpec|IPXC_FileSpec]] which description would be edited.
 
|-
 
|-
 
| class="op_param_name" | Annot
 
| class="op_param_name" | Annot
 
| style="text-align:center" | IUnknown
 
| style="text-align:center" | IUnknown
| Specifies...
+
| Specifies the linked [[PXV:IPXC_Annotation|IPXC_Annotation]] which description would be modified along the file attachment.
 
|-
 
|-
 
| class="op_param_name" | Description
 
| class="op_param_name" | Description
 
| style="text-align:center" | String
 
| style="text-align:center" | String
| Specifies...
+
| Specifies the new description of the attachment and linked annotation if the attachment has one.
 
Default value: <tt>'''Empty String'''</tt>
 
Default value: <tt>'''Empty String'''</tt>
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
private void EditAttachmentDescription(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
 +
{
 +
int nID = Inst.Str2ID("op.attachments.edit", false);
 +
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
 +
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 +
input.Add().v = Doc;
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
PDFXEdit.IPXC_NameTree pTree = Doc.CoreDoc.GetNameTree("EmbeddedFiles");
 +
PDFXEdit.IAFS_FileSys pFSys = fsInst.DefaultFileSys;
 +
string sName;
 +
uint nAttachmentsCount = pTree.Count;
 +
if (nAttachmentsCount == 0)
 +
return;
 +
PDFXEdit.IPXS_PDFVariant pValue;
 +
//Getting first attachment
 +
pTree.Item(0, out sName, out pValue);
 +
PDFXEdit.IPXC_FileSpec FS = Doc.CoreDoc.GetFileSpecFromVariant(pValue);
 +
options["Attachment"].v = FS;
 +
options["Description"].v = "Fist attachment's description";
 +
Op.Do();
 +
}
 +
</pre>

Latest revision as of 04:47, 18 April 2016


Options Table

Name Type Value
Attachment IUnknown Specifies the IPXC_FileSpec which description would be edited.
Annot IUnknown Specifies the linked IPXC_Annotation which description would be modified along the file attachment.
Description String Specifies the new description of the attachment and linked annotation if the attachment has one.

Default value: Empty String

Sample

//C#
private void EditAttachmentDescription(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.attachments.edit", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	input.Add().v = Doc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	PDFXEdit.IPXC_NameTree pTree = Doc.CoreDoc.GetNameTree("EmbeddedFiles");
	PDFXEdit.IAFS_FileSys pFSys = fsInst.DefaultFileSys;
	string sName;
	uint nAttachmentsCount = pTree.Count;
	if (nAttachmentsCount == 0)
		return;
	PDFXEdit.IPXS_PDFVariant pValue;
	//Getting first attachment
	pTree.Item(0, out sName, out pValue);
	PDFXEdit.IPXC_FileSpec FS = Doc.CoreDoc.GetFileSpecFromVariant(pValue);
	options["Attachment"].v = FS;
	options["Description"].v = "Fist attachment's description";
	Op.Do();
}