public static void Run() { // ExStart:AttachNoteAnnotation // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Attachments(); // Instantiate Pdf document object Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf(); // Create a section in the Pdf Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add(); // Instantiate attachment instance Aspose.Pdf.Generator.Attachment noteAttachment = new Aspose.Pdf.Generator.Attachment(); // Add the attachment in the paragraphs collection of the section sec1.Paragraphs.Add(noteAttachment); // Set the attachment type to note to make it a note annotation noteAttachment.AttachmentType = Aspose.Pdf.Generator.AttachmentType.Note; // Set the content of the note annotation noteAttachment.NoteContent = "This is a note."; // Set the title or heading of the note noteAttachment.NoteHeading = "The title"; // Set the note to be opened when PDF document is opened noteAttachment.IsNoteOpen = true; dataDir = dataDir + "AttachNoteAnnotation_out_.pdf"; // Save the Pdf pdf1.Save(dataDir); // ExEnd:AttachNoteAnnotation }
public static void Run() { // ExStart:CustomizeNotePosition // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Attachments(); // Instantiate Pdf document object Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf(); // Create a section in the Pdf Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add(); // Instantiate attachment instance by calling its empty constructor Aspose.Pdf.Generator.Attachment noteAttachment = new Aspose.Pdf.Generator.Attachment(); // Add the attachment in the paragraphs collection of the section sec1.Paragraphs.Add(noteAttachment); // Set the attachment type to Note noteAttachment.AttachmentType = Aspose.Pdf.Generator.AttachmentType.Note; // Store some content for the note to display noteAttachment.NoteContent = "This is a test for note popup window positioning."; // Set the heading or title of the note noteAttachment.NoteHeading = "Test"; // Set the note to be opened when PDF document is opened noteAttachment.IsNoteOpen = true; // Set the positioning type of the note's popup window to Absolute noteAttachment.NoteWindowPositioningType = Aspose.Pdf.Generator.NoteWindowPositioningType.Absolute; // Set the position of the note's popup window noteAttachment.NoteWindowPosition = new Aspose.Pdf.Generator.RectangleArea(100, 100, 160, 100); dataDir = dataDir + "CustomizeNotePosition_out_.pdf"; // Save the Pdf pdf1.Save(dataDir); // ExEnd:CustomizeNotePosition }
public static void Run() { // ExStart:AttachAnyFile // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Attachments(); // Instantiate Pdf document object Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf(); // Create a section in the Pdf Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add(); // Instantiate attachment instance by calling its empty constructor Aspose.Pdf.Generator.Attachment fileAttachment = new Aspose.Pdf.Generator.Attachment(); // Add attachment in the paragraphs collection of the section sec1.Paragraphs.Add(fileAttachment); // Set attachment type to File using AttachmentType enumeration fileAttachment.AttachmentType = Aspose.Pdf.Generator.AttachmentType.File; // Set the path of the attachment file. This could be any file like doc, tif etc fileAttachment.AttachedFileName = dataDir + "input.pdf"; // Set the type of the file to be attached fileAttachment.AttachedFileType = "pdf"; // Set the file icon type to Graph fileAttachment.FileIconType = Aspose.Pdf.Generator.FileIconType.Graph; // Set the color of the icon to Brown fileAttachment.IconColor = new Aspose.Pdf.Generator.Color("Brown"); dataDir = dataDir + "AttachAnyFile_out_.pdf"; // Save the Pdf pdf1.Save(dataDir); // ExEnd:AttachAnyFile }