Op 24/02/2011 19:59, fachhoch schreef:
> thank you  very for your reply , actaully I dont need  a complex solution , I
> am looking for a simple solution , all that I need is give pdf some meta
> information, this could in form of comments, or annotations , or some other
> means , by opening the pdf   this information should be accessible , I
> cannot put this in a page  in pdf but some   other means    , please help
> what is simplest way to pass this information to pdf ?

This is a simple way:

PdfAnnotation annotation = PdfAnnotation.createSquareCircle(
        writer, rect, text, true);
annotation.put(PdfName.T, new PdfString(text));
annotation.put(PdfName.CONTENTS, null);
float[] red = { 1, 0, 0 };
annotation.put(PdfName.C, new PdfArray(red));

It creates a red Square annotation (defined by a Rectangle rect).
When somebody hovers over it, the String text is shown.

This is another possibility:

PdfAnnotation annotation =
   PdfAnnotation.createText(writer, rect, "tooltip", text, false, null);
PdfAppearance ap = writer.getDirectContent().createAppearance(rect.getWidth(), 
rect.getHeight());
annotation.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, ap);
float[] red = { 1, 0, 0 };
annotation.put(PdfName.C, new PdfArray(red));

It creates a Text annotation.

There may be many other different possibilities.
Please read ISO-32000-1 to find the type of annotation that meets your needs.
(I can't decide in your place; I don't know EXACTLY what you want.)


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

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