BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

AddAttachment Method

Adds an attachment to a PDF file.

void AddAttachment(string InputFileName,
                   string OutputFileName,
                   int From,
                   int To,
                   double Left,
                   double Top,
                   string Attachment,
                   string Author,
                   string Subject,
                   string Description,
                   prcAttachIcon Icon,
                   Color Color)

Sub AddAttachment(InputFileName As String, _
                  OutputFileName As String, _
                  From As Integer, _
                  To As Integer, _
                  Left As Double, _
                  Top As Double, _
                  Attachment As String, _
                  Author As String, _
                  Subject As String, _
                  Description As String, _
                  Icon As prcAttachIcon, _
                  Color As Color)

def AddAttachment(self,
                  InputFileName,
                  OutputFileName,
                  From,
                  To,
                  Left,
                  Top,
                  Attachment,
                  Author,
                  Subject,
                  Description,
                  Icon,
                  Color)
void AddAttachment(String InputFileName,
                   String OutputFileName,
                   int From,
                   int To,
                   double Left,
                   double Top,
                   String Attachment,
                   String Author,
                   String Subject,
                   String Description,
                   prcAttachIcon Icon,
                   int Color) throws PDFProcessorException

function AddAttachment($InputFileName,
                       $OutputFileName,
                       $From,
                       $To,
                       $Left,
                       $Top,
                       $Attachment,
                       $Author,
                       $Subject,
                       $Description,
                       $Icon,
                       $Color) 

BclPrcResult AddAttachment(const BclPDFProcessorSettings* pSettings,
                           const wchar_t* InputFileName,
                           const wchar_t* OutputFileName,
                           int From,
                           int To,
                           double Left,
                           double Top,
                           const wchar_t* Attachment,
                           const wchar_t* Author,
                           const wchar_t* Subject,
                           const wchar_t* Description,
                           BclPrcAttachIcon Icon,
                           BclColor Color);
Sub AddAttachment(InputFileName As String, _
                  OutputFileName As String, _
                  From As Long, _
                  To As Long, _
                  Left As Double, _
                  Top As Double, _
                  Attachment As String, _
                  Author As String, _
                  Subject As String, _
                  Description As String, _
                  Icon As prcAttachIcon, _
                  Color As OLE_COLOR)

bepproc +AttachmentAnnot -file <filename>
                         [-pages <range>]
                         [-left <dimension>]
                         [-top <dimension>]
                         [-icon graph|paperClip|clip|pushPin|pin|tag]
                         [-color <color>]
                         [-description <string>]
                         [-author <string>]
                         [-subject <string>]




Parameters

Return Values

N/A.

Remarks

Note 1: Coordinate system information:
1. The unit size of PDF user space is 1/72 inch (1 inch = 72 PDF user space unit).
2. The location of the origin (0, 0) is at top-left corner.
3. To get page size information from a PDF file, use GetPageSize method.
The page number uses zero-based index, meaning that page number starts from 0.

Note 2: OLE_COLOR conversion from various programming languages:

C++:

static_cast<OLE_COLOR>(RGB(0, 0, 255))

VB6:

RGB(0, 0, 255)

VB.NET:

Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

C#: (uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))
Others: 32 bit integer value in following format: 0x00bbggrr (in BGR format, not in RGB)

For more information about color translation, refer to MSDN Knowledge Base article Q131101.

Example Usage

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
 
oProcessor.AddAttachment "C:\test\input.pdf", _
                         "C:\test\output.pdf", _
                         0, _
                         0, _
                         120, _
                         80, _
                         "C:attachment.jpg", _
                         "Author", _
                         "Subject", _
                         "Description", _
                         PRC_ATTACHICON_PAPERCLIP, _
                         RGB(0, 0, 255)