how to put a video inside a pdf [closed]

0

How to insert a video into a pdf generated using the iTextSharp library?

I need the library because it also joins digital files and signature.

    
asked by anonymous 11.10.2017 / 21:10

1 answer

3

Using iTextSharp, do the following:

//cria o documento
var doc = new Document();
//caminho do arquivo gerado
String outfile = "c:/documento.pdf";
//pega instância do objeto PdfWriter
PdfWriter writer=PdfWriter.GetInstance(doc, new FileStream(outfile, FileMode.Create));
//abre o documento para escrita
doc.Open();
//cria uma instância da classe PdfFileSpecification
PdfFileSpecification fs = PdfFileSpecification.FileEmbedded(writer, "c:/video.mpg", "video.mpg", null);
//criar e adiciona uma anotação de vídeo no documento
writer.AddAnnotation(PdfAnnotation.CreateScreen(writer, new Rectangle(200f, 700f, 400f, 800f), "Vídeo", fs,"video/mpeg", true));
//fecha o documento
doc.Close();
//visualiza o resultado
System.Diagnostics.Process.Start(outfile);

The following file formats are supported:

  • .aiff --- audio / aiff
  • .au --- audio / basic
  • .avi --- video / avi
  • .mid --- audio / midi
  • .mov --- video / quicktime
  • .mp4 --- video / mp4
  • .mp4 --- audio / mp4
  • .mpeg --- video / mpeg
  • .smil --- application / smil
  • .swf --- application / x-shockwave-flash

Font

    
11.10.2017 / 21:51