Tutorial - File Attachment

Top  Previous  Next

This tutorial creates an application to attach (word or text) files to the PDF document.

 

[VB]

 

' Load the Document

PDFDoc.LoadFromFile (InputFile2)

Dim FilAtt As gtPDFFileAttachmentX

' Create the File Attachment Object

Set FilAtt = PDFDoc.CreatePDFFileAttachment()

 

' Set the File Attachment Properties.

FilAtt.FileName = InputFile1

FilAtt.Author = "Gnostice Information Technologies"

FilAtt.Subject = "File Attachment InputFile1"

FilAtt.Contents = "This is File Attachment Demo"

FilAtt.FileAttachmentIcon = TxgtFileAttachmentIcon.faTag

FilAtt.IconColor = RGB(0, 0, 255)

FilAtt.SetBounds 300, 300, 700, 700

' Insert the File Attachment

PDFDoc.InsertFileAttachment FilAtt, 1

' Save the Document

PDFDoc.SaveToFile (OutputFile)

 

 

[VC++]

 

// Load the Document

PDFDoc.LoadFromFile(InputFile2);

CgtPDFFileAttachmentX FilAtt;

// Create the File Attachment Object

FilAtt = PDFDoc.CreatePDFFileAttachment();

// Set the File Attachment Properties.

FilAtt.SetFileName(InputFile1);

FilAtt.SetAuthor("Gnostice Information Technologies");

FilAtt.SetSubject ("File Attachment InputFile1");

FilAtt.SetContents("This is File Attachment Demo");

FilAtt.SetFileAttachmentIcon(3);

FilAtt.SetIconColor(123);

FilAtt.SetBounds(300,300,700,700);

// Insert the File Attachment

PDFDoc.InsertFileAttachment(FilAtt,1);

// Save the Document

PDFDoc.SaveToFile(OutputFile);

 

[CS]

 

// Load the Document

PDFDoc.LoadFromFile(InputFile2);

gtPDFFileAttachmentX FilAtt;

// Create the File Attachment Object

FilAtt = PDFDoc.CreatePDFFileAttachment();

// Set the File Attachment Properties.

FilAtt.FileName = InputFile1;

FilAtt.Author = "Gnostice Information Technologies";

FilAtt.Subject = "File Attachment InputFile1";

FilAtt.Contents = "This is File Attachment Demo";

FilAtt.IconColor = 123;

FilAtt.SetBounds(300,300,700,700);

// Insert the File Attachment

PDFDoc.InsertFileAttachment(FilAtt,1);

PDFDoc.ShowSetupDialog = False;

PDFDoc.OpenAfterSave = True;

PDFDoc.SaveToFile(OutputFile);