Esempio n. 1
0
        private void DogAndCat()
        {
            // create embedded media file
            PdfEmbeddedFile EmbeddedMediaFile = new PdfEmbeddedFile(Document, "BugsBunny.mp4");

            // Section 8.5 page 669 table 8.64
            PdfDisplayMedia DisplayMedia = new PdfDisplayMedia(EmbeddedMediaFile);

            // display media options
            DisplayMedia.DisplayControls(true);

            // repeat count (zero is play indefinitly)
            DisplayMedia.RepeatCount(1);

//		DisplayMedia.SetMediaWindow(MediaWindow.Floating, 480, 270, WindowPosition.UpperLeft, WindowTitleBar.TitleBarWithCloseButton, WindowResize.KeepAspectRatio, "User video title");

            PdfRectangle AnnotRect = ImageSizePos.ImageArea(160, 120, 1.5, 2.0, 5.5, 7.0, ContentAlignment.TopLeft);

            // create PdfObject for annotation
            PdfAnnotation Annotation = new PdfAnnotation(Page, AnnotRect, DisplayMedia);

            PdfXObject NormalAppearance = new PdfXObject(Document, AnnotRect.Width, AnnotRect.Height);

            NormalAppearance.SaveGraphicsState();
            NormalAppearance.SetColorNonStroking(Color.CornflowerBlue);
            NormalAppearance.SetColorStroking(Color.DarkGoldenrod);
            NormalAppearance.DrawOval(0.0, 0.0, AnnotRect.Width, AnnotRect.Height, PaintOp.CloseFillStroke);
            NormalAppearance.RestoreGraphicsState();
            Annotation.Appearance(NormalAppearance);

            Annotation.ActivateActionWhenPageIsVisible(false);

            return;
        }
Esempio n. 2
0
        private PdfXObject AnnotationArea
        (
            Double Width,
            Double Height,
            Color FillColor,
            Color BorderColor,
            String Text
        )
        {
            PdfXObject XObject = new PdfXObject(Document, Width, Height);

            XObject.SaveGraphicsState();
            XObject.SetColorNonStroking(FillColor);
            XObject.SetColorStroking(BorderColor);
            XObject.DrawRectangle(0.02 * Width, 0.02 * Height, 0.96 * Width, 0.96 * Height, PaintOp.CloseFillStroke);
            XObject.SetColorNonStroking(BorderColor);
            XObject.DrawText(ArialNormal, 14.0, 0.5 * Width, 0.5 * Height, TextJustify.Center, Text);
            XObject.RestoreGraphicsState();
            return(XObject);
        }