Options

From PDF XChange PDF SDK
Jump to: navigation, search
 
Line 24: Line 24:
 
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();
}