On 07/11/05, Paulo Soares <[EMAIL PROTECTED]> wrote:
> Here's the solution:
>
> Document document = new Document(PageSize.A4);
> PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("c:\\test_attach.pdf"));
> document.open();
> PdfContentByte cb = writer.getDirectContent();
> cb.rectangle(100, 100, 100, 100);
> cb.stroke();
> Rectangle rect = new Rectangle(100, 100, 200, 200);
> PdfFileSpecification pf = PdfFileSpecification.fileEmbedded(writer,
> "c:\\thumb.png", "thumb.png", null);
> PdfAnnotation annot = PdfAnnotation.createFileAttachment(writer, rect,
> "thumb.png", pf);
> PdfAppearance ap = cb.createAppearance(100, 100);
> ap.setBoundingBox(rect);
> ap.setLineWidth(1);
> annot.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, ap);
> annot.setAppearance(PdfAnnotation.APPEARANCE_DOWN, ap);
> annot.setPage();
> writer.addAnnotation(annot);
> document.close();
>
And the maestro does it again! Great! Unfortunately this may mean I
ask a few more stupid questions, but that is what you get for having
an excellent pdf library ;-).
Cheers
Antoine-- This is where I should put some witty comment. ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
