Beispiel #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;
        }