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.
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.
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: