Options
From PDF XChange PDF SDK
Options Table
Name | Type | Value |
---|---|---|
Attachment | IUnknown | Specifies the IPXC_FileSpec which contents would be edited. |
Contents | IUnknown | Specifies the new content of the attachment. Note that it can be IStream , IAFS_Name or IAFS_File type.
|
Sample
01 | //C# |
02 | private void ModifyAttachmentContents(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst) |
03 | { |
04 | int nID = Inst.Str2ID( "op.attachments.modContents " , false ); |
05 | PDFXEdit.IOperation Op = Inst.CreateOp(nID); |
06 | PDFXEdit.ICabNode input = Op.Params.Root[ "Input" ]; |
07 | input.Add().v = Doc; |
08 | PDFXEdit.ICabNode options = Op.Params.Root[ "Options" ]; |
09 | PDFXEdit.IPXC_NameTree pTree = Doc.CoreDoc.GetNameTree( "EmbeddedFiles" ); |
10 | PDFXEdit.IAFS_FileSys pFSys = fsInst.DefaultFileSys; |
11 | string sName; |
12 | uint nAttachmentsCount = pTree.Count; |
13 | if (nAttachmentsCount == 0) |
14 | return ; |
15 | PDFXEdit.IPXS_PDFVariant pValue; |
16 | //Getting first attachment |
17 | pTree.Item(0, out sName, out pValue); |
18 | PDFXEdit.IPXC_FileSpec FS = Doc.CoreDoc.GetFileSpecFromVariant(pValue); |
19 | options[ "Attachment" ].v = FS; |
20 | PDFXEdit.IAFS_Name sourceFile = fsInst.DefaultFileSys.StringToName( "D:\\TestImage.png" ); //Converting string to name |
21 | options[ "Contents" ].v = sourceFile; |
22 | Op.Do(); |
23 | } |