You're not forgetting anything. The PDF conforming reader, as per ISO 32000, is allowed to change the appearance of an annotation when writing out changes (open/close is a change). There is no way to preserve your appearance change through an editing session, short of a plugin to the viewer in question.
Leonard On Oct 3, 2008, at 10:59 AM, BorisTheCat wrote: > > Take a look at the PDF created by the code below: > http://www.nabble.com/file/p19799531/example.pdf example.pdf > > I've changed the appearance of the annotation and all works well > until you > double-click on the > popup note. You'll notice that the appearance goes back to the > default for > that annotation type. > It's almost like my change to the APPEARANCE_NORMAL gets lost. Am I > forgetting something ? > Code that created the PDF if below: > > public static void main(String[] args) > { > Document document = new Document(); > > try > { > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream("c:/temp/example.pdf")); > > document.open(); > > PdfAnnotation anno = PdfAnnotation.createText(writer, new > Rectangle(100, 500, 172, 572), > "Comment", "This annotation made with > 'createText'", false, "Comment"); > > Image image = Image.getInstance("c:/temp/popup.bmp"); > image.setAbsolutePosition(0,0); > > PdfAppearance app = > writer.getDirectContent().createAppearance(image.getWidth(), > image.getHeight()); > app.addImage(image); > > anno.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, app); > anno.setAppearance(PdfAnnotation.APPEARANCE_DOWN, app); > anno.setAppearance(PdfAnnotation.APPEARANCE_ROLLOVER, app); > anno.setFlags(PdfAnnotation.FLAGS_PRINT); > > writer.addAnnotation(anno); > } > catch (Exception de) > { > de.printStackTrace(); > } > > // step 5: we close the document > document.close(); > } > > -- > View this message in context: > http://www.nabble.com/Problem-changing-appearance-of-PdfAnnotation-tp19799531p19799531.html > Sent from the iText - General mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php