예제 #1
0
 public Screen(Page page, SKRect box, String text, String mediaPath, String mimeType)
     : this(page, box, text, new MediaRendition(
                new MediaClipData(
                    FileSpecification.Get(
                        EmbeddedFile.Get(page.Document, mediaPath),
                        System.IO.Path.GetFileName(mediaPath)
                        ),
                    mimeType
                    )
                )
            )
 {
 }
예제 #2
0
        private void Populate(Document document)
        {
            Page page = new Page(document);

            document.Pages.Add(page);

            PrimitiveComposer        composer = new PrimitiveComposer(page);
            fonts::StandardType1Font font     = new fonts::StandardType1Font(document, fonts::StandardType1Font.FamilyEnum.Courier, true, false);

            composer.SetFont(font, 12);

            // Sticky note.
            composer.ShowText("Sticky note annotation:", new SKPoint(35, 35));
            new StickyNote(page, new SKPoint(50, 50), "Text of the Sticky note annotation")
            {
                IconType = StickyNote.IconTypeEnum.Note,
                Color    = DeviceRGBColor.Get(SKColors.Yellow),
                Popup    = new Popup(
                    page,
                    SKRect.Create(200, 25, 200, 75),
                    "Text of the Popup annotation (this text won't be visible as associating popups to markup annotations overrides the former's properties with the latter's)"
                    ),
                Author  = "Stefano",
                Subject = "Sticky note",
                IsOpen  = true
            };
            new StickyNote(page, new SKPoint(80, 50), "Text of the Help sticky note annotation")
            {
                IconType = StickyNote.IconTypeEnum.Help,
                Color    = DeviceRGBColor.Get(SKColors.Pink),
                Author   = "Stefano",
                Subject  = "Sticky note",
                Popup    = new Popup(
                    page,
                    SKRect.Create(400, 25, 200, 75),
                    "Text of the Popup annotation (this text won't be visible as associating popups to markup annotations overrides the former's properties with the latter's)"
                    )
            };
            new StickyNote(page, new SKPoint(110, 50), "Text of the Comment sticky note annotation")
            {
                IconType = StickyNote.IconTypeEnum.Comment,
                Color    = DeviceRGBColor.Get(SKColors.Green),
                Author   = "Stefano",
                Subject  = "Sticky note"
            };
            new StickyNote(page, new SKPoint(140, 50), "Text of the Key sticky note annotation")
            {
                IconType = StickyNote.IconTypeEnum.Key,
                Color    = DeviceRGBColor.Get(SKColors.Blue),
                Author   = "Stefano",
                Subject  = "Sticky note"
            };

            // Callout.
            composer.ShowText("Callout note annotation:", new SKPoint(35, 85));
            new FreeText(page, SKRect.Create(250, 90, 150, 70), "Text of the Callout note annotation")
            {
                Line = new FreeText.CalloutLine(
                    page,
                    new SKPoint(100, 100),
                    new SKPoint(150, 125),
                    new SKPoint(250, 125)
                    ),
                Type         = FreeText.TypeEnum.Callout,
                LineEndStyle = LineEndStyleEnum.OpenArrow,
                Border       = new Border(1),
                Color        = DeviceRGBColor.Get(SKColors.Yellow)
            };

            // File attachment.
            composer.ShowText("File attachment annotation:", new SKPoint(35, 135));
            new FileAttachment(
                page,
                SKRect.Create(50, 150, 15, 20),
                "Text of the File attachment annotation",
                FileSpecification.Get(
                    EmbeddedFile.Get(document, GetResourcePath("images" + Path.DirectorySeparatorChar + "gnu.jpg")),
                    "happyGNU.jpg")
                )
            {
                IconType = FileAttachment.IconTypeEnum.PaperClip,
                Author   = "Stefano",
                Subject  = "File attachment"
            };

            composer.ShowText("Line annotation:", new SKPoint(35, 185));
            {
                composer.BeginLocalState();
                composer.SetFont(font, 10);

                // Arrow line.
                composer.ShowText("Arrow:", new SKPoint(50, 200));
                new Line(
                    page,
                    new SKPoint(50, 260),
                    new SKPoint(200, 210),
                    "Text of the Arrow line annotation",
                    DeviceRGBColor.Get(SKColors.Black))
                {
                    StartStyle     = LineEndStyleEnum.Circle,
                    EndStyle       = LineEndStyleEnum.ClosedArrow,
                    CaptionVisible = true,
                    FillColor      = DeviceRGBColor.Get(SKColors.Green),
                    Author         = "Stefano",
                    Subject        = "Arrow line"
                };

                // Dimension line.
                composer.ShowText("Dimension:", new SKPoint(300, 200));
                new Line(
                    page,
                    new SKPoint(300, 220),
                    new SKPoint(500, 220),
                    "Text of the Dimension line annotation",
                    DeviceRGBColor.Get(SKColors.Blue)
                    )
                {
                    LeaderLineLength          = 20,
                    LeaderLineExtensionLength = 10,
                    StartStyle     = LineEndStyleEnum.OpenArrow,
                    EndStyle       = LineEndStyleEnum.OpenArrow,
                    Border         = new Border(1),
                    CaptionVisible = true,
                    Author         = "Stefano",
                    Subject        = "Dimension line"
                };

                composer.End();
            }

            var path = new SKPath();

            path.MoveTo(new SKPoint(50, 320));
            path.LineTo(new SKPoint(70, 305));
            path.LineTo(new SKPoint(110, 335));
            path.LineTo(new SKPoint(130, 320));
            path.LineTo(new SKPoint(110, 305));
            path.LineTo(new SKPoint(70, 335));
            path.LineTo(new SKPoint(50, 320));
            // Scribble.
            composer.ShowText("Scribble annotation:", new SKPoint(35, 285));
            new Scribble(
                page,
                new List <SKPath> {
                path
            },
                "Text of the Scribble annotation",
                DeviceRGBColor.Get(SKColors.Orange))
            {
                Border  = new Border(1, new LineDash(new double[] { 5, 2, 2, 2 })),
                Author  = "Stefano",
                Subject = "Scribble"
            };

            // Rectangle.
            composer.ShowText("Rectangle annotation:", new SKPoint(35, 350));
            new PdfClown.Documents.Interaction.Annotations.Rectangle(
                page,
                SKRect.Create(50, 370, 100, 30),
                "Text of the Rectangle annotation")
            {
                Color   = DeviceRGBColor.Get(SKColors.Red),
                Border  = new Border(1, new LineDash(new double[] { 5 })),
                Author  = "Stefano",
                Subject = "Rectangle",
                Popup   = new Popup(
                    page,
                    SKRect.Create(200, 325, 200, 75),
                    "Text of the Popup annotation (this text won't be visible as associating popups to markup annotations overrides the former's properties with the latter's)"
                    )
            };

            // Ellipse.
            composer.ShowText("Ellipse annotation:", new SKPoint(35, 415));
            new Ellipse(
                page,
                SKRect.Create(50, 440, 100, 30),
                "Text of the Ellipse annotation")
            {
                BorderEffect = new BorderEffect(BorderEffect.TypeEnum.Cloudy, 1),
                FillColor    = DeviceRGBColor.Get(SKColors.Cyan),
                Color        = DeviceRGBColor.Get(SKColors.Black),
                Author       = "Stefano",
                Subject      = "Ellipse"
            };

            // Rubber stamp.
            composer.ShowText("Rubber stamp annotations:", new SKPoint(35, 505));
            {
                fonts::Font stampFont = fonts::Font.Get(document, GetResourcePath("fonts" + Path.DirectorySeparatorChar + "TravelingTypewriter.otf"));
                new Stamp(
                    page,
                    new SKPoint(75, 570),
                    "This is a round custom stamp",
                    new StampAppearanceBuilder(document, StampAppearanceBuilder.TypeEnum.Round, "Done", 50, stampFont)
                    .Build()
                    )
                {
                    Rotation = -10,
                    Author   = "Stefano",
                    Subject  = "Custom stamp"
                };

                new Stamp(
                    page,
                    new SKPoint(210, 570),
                    "This is a squared (and round-cornered) custom stamp",
                    new StampAppearanceBuilder(document, StampAppearanceBuilder.TypeEnum.Squared, "Classified", 150, stampFont)
                {
                    Color = DeviceRGBColor.Get(SKColors.Orange)
                }.Build()
                    )
                {
                    Rotation = 15,
                    Author   = "Stefano",
                    Subject  = "Custom stamp"
                };

                fonts::Font stampFont2 = fonts::Font.Get(document, GetResourcePath("fonts" + Path.DirectorySeparatorChar + "MgOpenCanonicaRegular.ttf"));
                new Stamp(
                    page,
                    new SKPoint(350, 570),
                    "This is a striped custom stamp",
                    new StampAppearanceBuilder(document, StampAppearanceBuilder.TypeEnum.Striped, "Out of stock", 100, stampFont2)
                {
                    Color = DeviceRGBColor.Get(SKColors.Gray)
                }.Build()
                    )
                {
                    Rotation = 90,
                    Author   = "Stefano",
                    Subject  = "Custom stamp"
                };

                // Define the standard stamps template path!

                /*
                 * NOTE: The PDF specification defines several stamps (aka "standard stamps") whose rendering
                 * depends on the support of viewer applications. As such support isn't guaranteed, PDF Clown
                 * offers smooth, ready-to-use embedding of these stamps through the StampPath property of the
                 * document configuration: you can decide to point to the stamps directory of your Acrobat
                 * installation (e.g., in my GNU/Linux system it's located in
                 * "/opt/Adobe/Reader9/Reader/intellinux/plug_ins/Annotations/Stamps/ENU") or to the
                 * collection included in this distribution (std-stamps.pdf).
                 */
                document.Configuration.StampPath = GetResourcePath("../../pkg/templates/std-stamps.pdf");

                // Add a standard stamp, rotating it 15 degrees counterclockwise!
                new Stamp(
                    page,
                    new SKPoint(485, 515),
                    null, // Default size is natural size.
                    "This is 'Confidential', a standard stamp",
                    StandardStampEnum.Confidential)
                {
                    Rotation = 15,
                    Author   = "Stefano",
                    Subject  = "Standard stamp"
                };

                // Add a standard stamp, without rotation!
                new Stamp(
                    page,
                    new SKPoint(485, 580),
                    null, // Default size is natural size.
                    "This is 'SBApproved', a standard stamp",
                    StandardStampEnum.BusinessApproved)
                {
                    Author  = "Stefano",
                    Subject = "Standard stamp"
                };

                // Add a standard stamp, rotating it 10 degrees clockwise!
                new Stamp(
                    page,
                    new SKPoint(485, 635),
                    new SKSize(0, 40), // This scales the width proportionally to the 40-unit height (you can obviously do also the opposite, defining only the width).
                    "This is 'SHSignHere', a standard stamp",
                    StandardStampEnum.SignHere)
                {
                    Rotation = -10,
                    Author   = "Stefano",
                    Subject  = "Standard stamp"
                };
            }

            composer.ShowText("Text markup annotations:", new SKPoint(35, 650));
            {
                composer.BeginLocalState();
                composer.SetFont(font, 8);

                new TextMarkup(
                    page,
                    composer.ShowText("Highlight annotation", new SKPoint(35, 680)),
                    "Text of the Highlight annotation",
                    TextMarkup.MarkupTypeEnum.Highlight)
                {
                    Author  = "Stefano",
                    Subject = "An highlight text markup!"
                };
                new TextMarkup(
                    page,
                    composer.ShowText("Highlight annotation 2", new SKPoint(35, 695)).Inflate(0, 1),
                    "Text of the Highlight annotation 2",
                    TextMarkup.MarkupTypeEnum.Highlight)
                {
                    Color = DeviceRGBColor.Get(SKColors.Magenta)
                };
                new TextMarkup(
                    page,
                    composer.ShowText("Highlight annotation 3", new SKPoint(35, 710)).Inflate(0, 2),
                    "Text of the Highlight annotation 3",
                    TextMarkup.MarkupTypeEnum.Highlight)
                {
                    Color = DeviceRGBColor.Get(SKColors.Red)
                };

                new TextMarkup(
                    page,
                    composer.ShowText("Squiggly annotation", new SKPoint(180, 680)),
                    "Text of the Squiggly annotation",
                    TextMarkup.MarkupTypeEnum.Squiggly);
                new TextMarkup(
                    page,
                    composer.ShowText("Squiggly annotation 2", new SKPoint(180, 695)).Inflate(0, 2.5f),
                    "Text of the Squiggly annotation 2",
                    TextMarkup.MarkupTypeEnum.Squiggly)
                {
                    Color = DeviceRGBColor.Get(SKColors.Orange)
                };
                new TextMarkup(
                    page,
                    composer.ShowText("Squiggly annotation 3", new SKPoint(180, 710)).Inflate(0, 3),
                    "Text of the Squiggly annotation 3",
                    TextMarkup.MarkupTypeEnum.Squiggly)
                {
                    Color = DeviceRGBColor.Get(SKColors.Pink)
                };

                new TextMarkup(
                    page,
                    composer.ShowText("Underline annotation", new SKPoint(320, 680)),
                    "Text of the Underline annotation",
                    TextMarkup.MarkupTypeEnum.Underline
                    );
                new TextMarkup(
                    page,
                    composer.ShowText("Underline annotation 2", new SKPoint(320, 695)).Inflate(0, 2.5f),
                    "Text of the Underline annotation 2",
                    TextMarkup.MarkupTypeEnum.Underline
                    )
                {
                    Color = DeviceRGBColor.Get(SKColors.Orange)
                };
                new TextMarkup(
                    page,
                    composer.ShowText("Underline annotation 3", new SKPoint(320, 710)).Inflate(0, 3),
                    "Text of the Underline annotation 3",
                    TextMarkup.MarkupTypeEnum.Underline
                    )
                {
                    Color = DeviceRGBColor.Get(SKColors.Green)
                };

                new TextMarkup(
                    page,
                    composer.ShowText("StrikeOut annotation", new SKPoint(455, 680)),
                    "Text of the StrikeOut annotation",
                    TextMarkup.MarkupTypeEnum.StrikeOut
                    );
                new TextMarkup(
                    page,
                    composer.ShowText("StrikeOut annotation 2", new SKPoint(455, 695)).Inflate(0, 2.5f),
                    "Text of the StrikeOut annotation 2",
                    TextMarkup.MarkupTypeEnum.StrikeOut
                    )
                {
                    Color = DeviceRGBColor.Get(SKColors.Orange)
                };
                new TextMarkup(
                    page,
                    composer.ShowText("StrikeOut annotation 3", new SKPoint(455, 710)).Inflate(0, 3),
                    "Text of the StrikeOut annotation 3",
                    TextMarkup.MarkupTypeEnum.StrikeOut
                    )
                {
                    Color = DeviceRGBColor.Get(SKColors.Green)
                };

                composer.End();
            }
            composer.Flush();
        }
예제 #3
0
        public override void Run(
            )
        {
            // 1. Externalizing the streams...
            string externalizedFilePath;
            {
                // 1.1. Opening the PDF file...
                string filePath = PromptFileChoice("Please select a PDF file");
                using (var file = new files::File(filePath))
                {
                    Document document = file.Document;

                    /*
                     * NOTE: As we are going to export streams using paths relative to the output path, it's
                     * necessary to ensure they are properly resolved (otherwise they will be written relative to
                     * the current user directory).
                     */
                    file.Path = OutputPath;

                    // 1.2. Iterating through the indirect objects to externalize streams...
                    int filenameIndex = 0;
                    foreach (PdfIndirectObject indirectObject in file.IndirectObjects)
                    {
                        PdfDataObject dataObject = indirectObject.DataObject;
                        if (dataObject is PdfStream)
                        {
                            PdfStream stream = (PdfStream)dataObject;
                            if (stream.DataFile == null) // Internal stream to externalize.
                            {
                                stream.SetDataFile(
                                    FileSpecification.Get(
                                        document,
                                        GetType().Name + "-external" + filenameIndex++
                                        ),
                                    true // Forces the stream data to be transferred to the external location.
                                    );
                            }
                        }
                    }

                    // 1.3. Serialize the PDF file!
                    externalizedFilePath = Serialize(file, files::SerializationModeEnum.Standard);
                }
            }

            // 2. Reimporting the externalized streams...
            {
                // 2.1. Opening the PDF file...
                using (var file = new files::File(externalizedFilePath))
                {
                    // 2.2. Iterating through the indirect objects to internalize streams...
                    foreach (PdfIndirectObject indirectObject in file.IndirectObjects)
                    {
                        PdfDataObject dataObject = indirectObject.DataObject;
                        if (dataObject is PdfStream)
                        {
                            PdfStream stream = (PdfStream)dataObject;
                            if (stream.DataFile != null) // External stream to internalize.
                            {
                                stream.SetDataFile(
                                    null,
                                    true // Forces the stream data to be transferred to the internal location.
                                    );
                            }
                        }
                    }

                    // 2.3. Serialize the PDF file!
                    string externalizedFileName = Path.GetFileNameWithoutExtension(externalizedFilePath);
                    string internalizedFilePath = externalizedFileName + "-reimported.pdf";
                    Serialize(file, internalizedFilePath, files::SerializationModeEnum.Standard);
                }
            }
        }
예제 #4
0
        private void BuildLinks(Document document)
        {
            Pages pages = document.Pages;
            Page  page  = new Page(document);

            pages.Add(page);

            PrimitiveComposer composer      = new PrimitiveComposer(page);
            BlockComposer     blockComposer = new BlockComposer(composer);

            PdfType1Font font = PdfType1Font.Load(document, PdfType1Font.FamilyEnum.Courier, true, false);

            /*
             * 2.1. Goto-URI link.
             */
            {
                blockComposer.Begin(SKRect.Create(30, 100, 200, 50), XAlignmentEnum.Left, YAlignmentEnum.Middle);
                composer.SetFont(font, 12);
                blockComposer.ShowText("Go-to-URI link");
                composer.SetFont(font, 8);
                blockComposer.ShowText("\nIt allows you to navigate to a network resource.");
                composer.SetFont(font, 5);
                blockComposer.ShowText("\n\nClick on the box to go to the project's SourceForge.net repository.");
                blockComposer.End();

                /*
                 * NOTE: This statement instructs the PDF viewer to navigate to the given URI when the link is clicked.
                 */
                new Link(page, SKRect.Create(240, 100, 100, 50), "Link annotation",
                         new GoToURI(document, new Uri("http://www.sourceforge.net/projects/clown")))
                {
                    Border = new Border(3, BorderStyleType.Beveled)
                };
            }

            /*
             * 2.2. Embedded-goto link.
             */
            {
                string filePath = PromptFileChoice("Please select a PDF file to attach");

                /*
                 * NOTE: These statements instruct PDF Clown to attach a PDF file to the current document.
                 * This is necessary in order to test the embedded-goto functionality,
                 * as you can see in the following link creation (see below).
                 */
                int    fileAttachmentPageIndex = page.Index;
                string fileAttachmentName      = "attachedSamplePDF";
                string fileName = System.IO.Path.GetFileName(filePath);
                new FileAttachment(
                    page,
                    SKRect.Create(0, -20, 10, 10),
                    "File attachment annotation",
                    FileSpecification.Get(EmbeddedFile.Get(document, filePath),
                                          fileName
                                          )
                    )
                {
                    Name           = fileAttachmentName,
                    AttachmentName = FileAttachmentImageType.PaperClip
                };

                blockComposer.Begin(SKRect.Create(30, 170, 200, 50), XAlignmentEnum.Left, YAlignmentEnum.Middle);
                composer.SetFont(font, 12);
                blockComposer.ShowText("Go-to-embedded link");
                composer.SetFont(font, 8);
                blockComposer.ShowText("\nIt allows you to navigate to a destination within an embedded PDF file.");
                composer.SetFont(font, 5);
                blockComposer.ShowText("\n\nClick on the button to go to the 2nd page of the attached PDF file (" + fileName + ").");
                blockComposer.End();

                /*
                 * NOTE: This statement instructs the PDF viewer to navigate to the page 2 of a PDF file
                 * attached inside the current document as described by the FileAttachment annotation on page 1 of the current document.
                 */
                new Link(
                    page,
                    SKRect.Create(240, 170, 100, 50),
                    "Link annotation",
                    new GoToEmbedded(
                        document,
                        new GoToEmbedded.PathElement(
                            document,
                            fileAttachmentPageIndex, // Page of the current document containing the file attachment annotation of the target document.
                            fileAttachmentName,      // Name of the file attachment annotation corresponding to the target document.
                            null                     // No sub-target.
                            ),                       // Target represents the document to go to.
                        new RemoteDestination(
                            document,
                            1,                        // Show the page 2 of the target document.
                            Destination.ModeEnum.Fit, // Show the target document page entirely on the screen.
                            null,
                            null
                            ) // The destination must be within the target document.
                        )
                    )
                {
                    Border = new Border(1, new LineDash(new float[] { 8, 5, 2, 5 }))
                };
            }

            /*
             * 2.3. Textual link.
             */
            {
                blockComposer.Begin(SKRect.Create(30, 240, 200, 50), XAlignmentEnum.Left, YAlignmentEnum.Middle);
                composer.SetFont(font, 12);
                blockComposer.ShowText("Textual link");
                composer.SetFont(font, 8);
                blockComposer.ShowText("\nIt allows you to expose any kind of link (including the above-mentioned types) as text.");
                composer.SetFont(font, 5);
                blockComposer.ShowText("\n\nClick on the text links to go either to the project's SourceForge.net repository or to the project's home page.");
                blockComposer.End();

                composer.BeginLocalState();
                composer.SetFont(font, 10);
                composer.SetFillColor(DeviceRGBColor.Get(SKColors.Blue));
                composer.ShowText(
                    "PDF Clown Project's repository at SourceForge.net",
                    new SKPoint(240, 265),
                    XAlignmentEnum.Left,
                    YAlignmentEnum.Middle,
                    0,
                    new GoToURI(
                        document,
                        new Uri("http://www.sourceforge.net/projects/clown")
                        )
                    );
                composer.ShowText(
                    "PDF Clown Project's home page",
                    new SKPoint(240, 285),
                    XAlignmentEnum.Left,
                    YAlignmentEnum.Bottom,
                    -90,
                    new GoToURI(
                        document,
                        new Uri("http://www.pdfclown.org")
                        )
                    );
                composer.End();
            }

            composer.Flush();
        }
예제 #5
0
        private void Populate(
            Document document
            )
        {
            Page page = new Page(document);

            document.Pages.Add(page);

            PrimitiveComposer composer = new PrimitiveComposer(page);
            StandardType1Font font     = new StandardType1Font(
                document,
                StandardType1Font.FamilyEnum.Courier,
                true,
                false
                );

            composer.SetFont(font, 12);

            // Note.
            composer.ShowText("Note annotation:", new Point(35, 35));
            annotations::Note note = new annotations::Note(
                page,
                new Point(50, 50),
                "Note annotation"
                );

            note.IconType         = annotations::Note.IconTypeEnum.Help;
            note.ModificationDate = new DateTime();
            note.IsOpen           = true;

            // Callout.
            composer.ShowText("Callout note annotation:", new Point(35, 85));
            annotations::CalloutNote calloutNote = new annotations::CalloutNote(
                page,
                new Rectangle(50, 100, 200, 24),
                "Callout note annotation"
                );

            calloutNote.Justification = JustificationEnum.Right;
            calloutNote.Line          = new annotations::CalloutNote.LineObject(
                page,
                new Point(150, 650),
                new Point(100, 600),
                new Point(50, 100)
                );

            // File attachment.
            composer.ShowText("File attachment annotation:", new Point(35, 135));
            annotations::FileAttachment attachment = new annotations::FileAttachment(
                page,
                new Rectangle(50, 150, 12, 12),
                "File attachment annotation",
                FileSpecification.Get(
                    EmbeddedFile.Get(
                        document,
                        GetResourcePath("images" + Path.DirectorySeparatorChar + "gnu.jpg")
                        ),
                    "happyGNU.jpg"
                    )
                );

            attachment.IconType = annotations::FileAttachment.IconTypeEnum.PaperClip;

            composer.BeginLocalState();

            // Arrow line.
            composer.ShowText("Line annotation:", new Point(35, 185));
            composer.SetFont(font, 10);
            composer.ShowText("Arrow:", new Point(50, 200));
            annotations::Line line = new annotations::Line(
                page,
                new Point(50, 260),
                new Point(200, 210),
                "Arrow line annotation"
                );

            line.FillColor      = new DeviceRGBColor(1, 0, 0);
            line.StartStyle     = annotations::Line.LineEndStyleEnum.Circle;
            line.EndStyle       = annotations::Line.LineEndStyleEnum.ClosedArrow;
            line.CaptionVisible = true;

            // Dimension line.
            composer.ShowText("Dimension:", new Point(300, 200));
            line = new annotations::Line(
                page,
                new Point(300, 220),
                new Point(500, 220),
                "Dimension line annotation"
                );
            line.LeaderLineLength          = 20;
            line.LeaderLineExtensionLength = 10;
            line.CaptionVisible            = true;

            composer.End();

            // Scribble.
            composer.ShowText("Scribble annotation:", new Point(35, 285));
            new annotations::Scribble(
                page,
                new RectangleF(50, 300, 100, 30),
                "Scribble annotation",
                new List <IList <PointF> >(
                    new List <PointF>[]
            {
                new List <PointF>(
                    new PointF[]
                {
                    new PointF(50, 300),
                    new PointF(70, 310),
                    new PointF(100, 320)
                }
                    )
            }
                    )
                );

            // Rectangle.
            composer.ShowText("Rectangle annotation:", new Point(35, 335));
            annotations::Rectangle rectangle = new annotations::Rectangle(
                page,
                new Rectangle(50, 350, 100, 30),
                "Rectangle annotation"
                );

            rectangle.FillColor = new DeviceRGBColor(1, 0, 0);

            // Ellipse.
            composer.ShowText("Ellipse annotation:", new Point(35, 385));
            annotations::Ellipse ellipse = new annotations::Ellipse(
                page,
                new Rectangle(50, 400, 100, 30),
                "Ellipse annotation"
                );

            ellipse.FillColor = new DeviceRGBColor(0, 0, 1);

            // Rubber stamp.
            composer.ShowText("Rubber stamp annotation:", new Point(35, 435));
            new annotations::RubberStamp(
                page,
                new Rectangle(50, 450, 100, 30),
                "Rubber stamp annotation",
                annotations::RubberStamp.IconTypeEnum.Approved
                );

            // Caret.
            composer.ShowText("Caret annotation:", new Point(35, 485));
            annotations::Caret caret = new annotations::Caret(
                page,
                new Rectangle(50, 500, 100, 30),
                "Caret annotation"
                );

            caret.SymbolType = annotations::Caret.SymbolTypeEnum.NewParagraph;

            composer.Flush();
        }