Hi,
I try to add a rendition PdfAction to a PushbuttonField. The execution
of my java program do it. But when I click the button in the Pdf File,
I get the message
"Impossible d'effectuer l'action. Le fichier est incorrect ou requiert
une version plus récente d'Acrobat." for which the translation is
approximately "Impossible to manage the action. The file is incorrect
or it needs a more recent version of Acrobat".
But if I use a simple Annotation, it works. Could you explain me why please ?
The sample code I used follows
PdfContentByte cb2 = writer2.getDirectContent();
Annotation a15 = new Annotation(100f, 580f, 150f, 600f,
"d:/chanson.mp3", "audio/mpeg", false);
document2.add(a15);
PdfFileSpecification fs = PdfFileSpecification.fileEmbedded(writer2,
"d:/chanson.mp3", "chanson", null);
Image img = Image.getInstance("d:/PX100.jpg");
PushbuttonField bt = new PushbuttonField(writer2, new Rectangle(100,
680, 150, 710), "Button1");
bt.setImage(img);
bt.setLayout(PushbuttonField.LAYOUT_ICON_TOP_LABEL_BOTTOM);
bt.setBackgroundColor(Color.white);
bt.setBorderStyle(PdfBorderDictionary.STYLE_BEVELED);
bt.setBorderColor(Color.black);
bt.setBorderWidth(1);
PdfFormField ff = bt.getField() ;
PdfAction ac =
PdfAction.rendition("chanson",fs,"audio/mpeg",writer2.getPdfIndirectReference())
;
ff.setAction(ac);
writer2.addAnnotation(ff);
Thanks a lot.
Excuse me for my poor english
Jérôme
- [iText-questions] PdfAction with PushbuttonField doesn't ... Jérome Vérité
