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 Example1() { // create embedded media file PdfEmbeddedFile LooneyTunes = new PdfEmbeddedFile(Document, "LooneyTunes.mp4"); PdfDisplayMedia DisplayMedia = new PdfDisplayMedia(LooneyTunes); PdfRectangle AnnotRect = ImageSizePos.ImageArea(480, 360, new PdfRectangle(1.2, 6.2, 7.3, 8.3), ContentAlignment.MiddleRight); // create PdfObject for annotation PdfAnnotation Annotation = new PdfAnnotation(Page, AnnotRect, DisplayMedia); Annotation.ActivateActionWhenPageIsVisible(false); return; }
private void Benny() { // create embedded media file PdfEmbeddedFile EmbeddedMediaFile = new PdfEmbeddedFile(Document, "Benny.mov"); // Section 8.5 page 669 table 8.64 PdfDisplayMedia DisplayMedia = new PdfDisplayMedia(EmbeddedMediaFile); // repeat count (zero is play indefinitly) DisplayMedia.RepeatCount(0); PdfRectangle AnnotRect = ImageSizePos.ImageArea(1920, 1080, 1.5, 2.0, 5.5, 7.0, ContentAlignment.TopLeft); // create PdfObject for annotation PdfAnnotation Annotation = new PdfAnnotation(Page, AnnotRect, DisplayMedia); return; }