static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add page Page page = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page); // Add video annotation Movie movie = new Movie("sample.avi"); MovieAnnotation movieAnnotation = new MovieAnnotation(movie, 20, 20, 320, 240); movieAnnotation.MovieActivation.ShowControls = true; page.Annotations.Add(movieAnnotation); // Save document to file pdfDocument.Save("result.pdf"); // Cleanup pdfDocument.Dispose(); // Open document in default PDF viewer app Process.Start("result.pdf"); }
static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add page Page page = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page); // Add video annotation Movie movie = new Movie("sample.avi"); MovieAnnotation movieAnnotation = new MovieAnnotation(movie, 20, 20, 320, 240); movieAnnotation.MovieActivation.ShowControls = true; page.Annotations.Add(movieAnnotation); // Save document to file pdfDocument.Save("result.pdf"); // Cleanup pdfDocument.Dispose(); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); }
public void PutMovieAnnotationExample() { //ExStart: PutMovieAnnotationExample UploadFile(AttachmentFile, AttachmentFile); MovieAnnotation annotation = new MovieAnnotation() { Name = "Updated Example", Rect = new Rectangle(100, 100, 200, 200), Flags = new List <AnnotationFlags> { AnnotationFlags.Hidden, AnnotationFlags.NoView }, HorizontalAlignment = HorizontalAlignment.Center, ZIndex = 1, FilePath = AttachmentFile, Modified = "01/01/2018 00:00:00.000 AM" }; var lineResponse = api.GetDocumentMovieAnnotations(Name, folder: FolderName); string annotationId = lineResponse.Annotations.List[0].Id; var response = api.PutMovieAnnotation(Name, annotationId, annotation, folder: FolderName); Console.WriteLine(response); //ExEnd: PutMovieAnnotationExample }
/// <summary> /// Initializes a new instance of the Bytescout.PDF.MovieAction. /// </summary> /// <param name="annotation">A movie annotation identifying the movie to be played.</param> /// <param name="operation">The operation to be performed on the movie.</param> public MovieAction(MovieAnnotation annotation, MovieOperation operation) : base(null) { if (annotation == null) { throw new ArgumentNullException("annotation"); } _dictionary = new PDFDictionary(); _dictionary.AddItem("Type", new PDFName("Action")); _dictionary.AddItem("S", new PDFName("Movie")); _dictionary.AddItem("Annotation", annotation.Dictionary); Operation = operation; }
internal override Annotation Clone(IDocumentEssential owner, Page page) { if (Page == null) { ApplyOwner(owner); SetPage(page, true); return(this); } PDFDictionary res = AnnotationBase.Copy(Dictionary); IPDFObject t = Dictionary["T"]; if (t != null) { res.AddItem("T", t.Clone()); } PDFDictionary movie = Dictionary["Movie"] as PDFDictionary; if (movie != null) { res.AddItem("Movie", MovieBase.Copy(movie)); } IPDFObject a = Dictionary["A"]; if (a != null) { if (a is PDFBoolean) { res.AddItem("A", a.Clone()); } else if (a is PDFDictionary) { res.AddItem("A", MovieActivationBase.Copy(a as PDFDictionary)); } } MovieAnnotation annot = new MovieAnnotation(res, owner); annot.SetPage(Page, false); annot.SetPage(page, true); return(annot); }
public void PutMovieAnnotationTest() { UploadFile(AttachmentFile, AttachmentFile); MovieAnnotation annotation = new MovieAnnotation(Rect: new Rectangle(100, 100, 200, 200)) { Name = "Updated Test", Flags = new List <AnnotationFlags> { AnnotationFlags.Hidden, AnnotationFlags.NoView }, HorizontalAlignment = HorizontalAlignment.Center, ZIndex = 1, FilePath = AttachmentFile, Modified = "01/01/2018 00:00:00.000 AM" }; var lineResponse = PdfApi.GetDocumentMovieAnnotations(Name, folder: TempFolder); string annotationId = lineResponse.Annotations.List[0].Id; var response = PdfApi.PutMovieAnnotation(Name, annotationId, annotation, folder: TempFolder); Assert.That(response.Code, Is.EqualTo(200)); }
private void parseAnnotations() { for (int i = 0; i < _array.Count; ++i) { PDFDictionary annotDict = _array[i] as PDFDictionary; if (annotDict != null) { if (annotDict["IRT"] == null) { PDFName subtype = annotDict["Subtype"] as PDFName; if (subtype != null) { Annotation annot = null; switch (subtype.GetValue()) { case "Text": annot = new TextAnnotation(annotDict, _owner); break; case "Link": annot = new LinkAnnotation(annotDict, _owner); break; case "FreeText": annot = new FreeTextAnnotation(annotDict, _owner); break; case "Line": annot = new LineAnnotation(annotDict, _owner); break; case "Square": annot = new SquareAnnotation(annotDict, _owner); break; case "Circle": annot = new CircleAnnotation(annotDict, _owner); break; case "Polygon": annot = new PolygonAnnotation(annotDict, _owner); break; case "PolyLine": annot = new PolylineAnnotation(annotDict, _owner); break; case "Highlight": annot = new HighlightAnnotation(annotDict, _owner); break; case "Underline": annot = new UnderlineAnnotation(annotDict, _owner); break; case "Squiggly": annot = new SquigglyAnnotation(annotDict, _owner); break; case "StrikeOut": annot = new StrikeOutAnnotation(annotDict, _owner); break; case "Stamp": annot = new RubberStampAnnotation(annotDict, _owner); break; case "Caret": annot = new CaretAnnotation(annotDict, _owner); break; case "Ink": annot = new InkAnnotation(annotDict, _owner); break; case "FileAttachment": annot = new FileAttachmentAnnotation(annotDict, _owner); break; case "Sound": annot = new SoundAnnotation(annotDict, _owner); break; case "Movie": annot = new MovieAnnotation(annotDict, _owner); break; case "Screen": annot = new ScreenAnnotation(annotDict, _owner); break; case "3D": annot = new ThreeDAnnotation(annotDict, _owner); break; case "Widget": PDFName ft = annotDict["FT"] as PDFName; if (ft == null) { PDFDictionary parent = annotDict["Parent"] as PDFDictionary; if (parent != null) { ft = parent["FT"] as PDFName; } } if (ft != null) { switch (ft.GetValue()) { case "Tx": annot = new EditBox(annotDict, _owner); break; case "Ch": uint flag = getFlag(annotDict); if ((flag >> 17) % 2 != 0) { annot = new ComboBox(annotDict, _owner); } else { annot = new ListBox(annotDict, _owner); } break; case "Btn": flag = getFlag(annotDict); if ((flag >> 16) % 2 != 0) { annot = new PushButton(annotDict, _owner); } else if ((flag >> 15) % 2 != 0) { annot = new RadioButton(annotDict, _owner); } else { annot = new CheckBox(annotDict, _owner); } break; } } break; } if (annot != null) { annot.SetPage(_page, false); _annotations.Add(annot); } } } } } }