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: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           
        }
Example #3
0
        public static void ParagraphsCustomPositioning()
        {
            // ExStart:ParagraphsCustomPositioning
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a text paragraph
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text("This is a text paragraph.");

            // Set the id of the paragraph to "text1" so that it can referenced uniquely
            text1.ID = "text1";

            // Add the paragraph to the section
            sec1.Paragraphs.Add(text1);

            // Create a graph with specified left and top position settings. Set its
            // poition relative to the page. Add a rectangle to its shapes collection and
            // then add the graph to the paragraph collection of the section
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(200, 50);
            graph1.Left            = 200;
            graph1.Top             = 10;
            graph1.PositioningType = Aspose.Pdf.Generator.PositioningType.PageRelative;
            graph1.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(0, 0, 200, 50));
            sec1.Paragraphs.Add(graph1);

            // Create an attachment as note annotation and add it to the section as a
            // pragraph. Set the content and heading for the note. Set its position relative
            // to the paragraph. Assign a unique id to this note annotation for the
            // reference purposes and then customize its left and top position
            Aspose.Pdf.Generator.Attachment noteAttachment = new Aspose.Pdf.Generator.Attachment();
            sec1.Paragraphs.Add(noteAttachment);
            noteAttachment.AttachmentType       = Aspose.Pdf.Generator.AttachmentType.Note;
            noteAttachment.NoteContent          = "This is a test for note";
            noteAttachment.NoteHeading          = "this is a Note";
            noteAttachment.PositioningType      = Aspose.Pdf.Generator.PositioningType.ParagraphRelative;
            noteAttachment.ReferenceParagraphID = "text1";
            noteAttachment.Left = 200;
            noteAttachment.Top  = 0;

            dataDir = dataDir + "ParagraphsCustomPositioning_out_.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:ParagraphsCustomPositioning
        }
        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           
        }
Example #5
0
        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
        }
Example #6
0
        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
        }
        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           
        }
        public static void ParagraphsCustomPositioning()
        {
            // ExStart:ParagraphsCustomPositioning
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a text paragraph
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text("This is a text paragraph.");

            // Set the id of the paragraph to "text1" so that it can referenced uniquely
            text1.ID = "text1";

            // Add the paragraph to the section
            sec1.Paragraphs.Add(text1);

            // Create a graph with specified left and top position settings. Set its
            // Poition relative to the page. Add a rectangle to its shapes collection and
            // Then add the graph to the paragraph collection of the section
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(200, 50);
            graph1.Left = 200;
            graph1.Top = 10;
            graph1.PositioningType = Aspose.Pdf.Generator.PositioningType.PageRelative;
            graph1.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(0, 0, 200, 50));
            sec1.Paragraphs.Add(graph1);

            // Create an attachment as note annotation and add it to the section as a
            // Pragraph. Set the content and heading for the note. Set its position relative
            // To the paragraph. Assign a unique id to this note annotation for the
            // Reference purposes and then customize its left and top position
            Aspose.Pdf.Generator.Attachment noteAttachment = new Aspose.Pdf.Generator.Attachment();
            sec1.Paragraphs.Add(noteAttachment);
            noteAttachment.AttachmentType = Aspose.Pdf.Generator.AttachmentType.Note;
            noteAttachment.NoteContent = "This is a test for note";
            noteAttachment.NoteHeading = "this is a Note";
            noteAttachment.PositioningType = Aspose.Pdf.Generator.PositioningType.ParagraphRelative;
            noteAttachment.ReferenceParagraphID = "text1";
            noteAttachment.Left = 200;
            noteAttachment.Top = 0; 

            dataDir = dataDir + "ParagraphsCustomPositioning_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:ParagraphsCustomPositioning           
        }