Hi Guys,

I'm trying to insert several mp4s into multiple PdfPCells. It made the most
sense to me to attach the annotation directly on the image but I get an
error that com.lowagie.text.Annotation is required instead of 
com.lowagie.text.pdf.PdfAnnotation. So I tried putting the Image into a
Chunk, then attaching the PDFAnnotation to the Chunk. That creates the PDF
file but I get an error (Cannot Perform Action. File is Invalid) when I
click the image. I know the mp4 is inserted as the file size reflects the
change. I can insert the video using ColumnText as discussed in another post
but I need the ease of use of putting it directly into a system I have setup
using PdfPTable's and cells.

Here's the code the creates the PDF but throws an error when the image is
clicked on. I'd greatly appreciate some advice on what I'm doing wrong.

PdfFileSpecification fs = PdfFileSpecification.fileEmbedded(writer,
"320test.mp4", "320test.mp4", null);
PdfAnnotation annotx = PdfAnnotation.createScreen(writer, null,
"320test.mp4", fs, "video/mp4", true);
Image imm = Image.getInstance("videoImage.jpg");
        
//imm.setAnnotation(annotx); // Doesn't work as it wants an Annotation
instead of PDFAnnotation

PdfAppearance app =
writer.getDirectContent().createAppearance(imm.getWidth(), imm.getHeight()); 
annotx.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, app);   
            
Chunk chunk = new Chunk(imm, 0, 0);
chunk.setAnnotation(annotx);
                       
myTable.addCell(new Phrase(chunk));

Thanks,
Dominic

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Problem-using-PDFAnnotation-to-insert-video-into-PdfPCell-tp4622962.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to