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; }
private void Example2() { // create embedded media file PdfEmbeddedFile EmbeddedMediaFile = new PdfEmbeddedFile(Document, "Ring01.wav"); PdfDisplayMedia DisplayMedia = new PdfDisplayMedia(EmbeddedMediaFile); //DisplayMedia.SetMediaWindow(MediaWindow.Hidden); PdfRectangle AnnotRect = new PdfRectangle(5.2, 3.7, 7.3, 5.8); // create PdfObject for annotation PdfAnnotation Annotation = new PdfAnnotation(Page, AnnotRect, DisplayMedia); PdfXObject Normal = AnnotationArea(AnnotRect.Width, AnnotRect.Height, Color.Lavender, Color.Indigo, "Normal"); PdfXObject RollOver = AnnotationArea(AnnotRect.Width, AnnotRect.Height, Color.Yellow, Color.Brown, "RollOver"); PdfXObject Down = AnnotationArea(AnnotRect.Width, AnnotRect.Height, Color.LightPink, Color.DarkRed, "Down"); Annotation.Appearance(Normal, RollOver, Down); return; }