Question about "IRT" entry for markup annotations.
- From: "Paulo Soares" <psoares (at) consiste.pt>
- Date: Mon, 6 Feb 2006 18:01:17 -0000
I can't see any reason why PdfAnnotation.getIndirectReference() is not
public. The fix is in the CVS.
> -----Original Message-----
> From: itext-questions-admin (at) lists.sourceforge.net
> [mailto:itext-questions-admin (at) lists.sourceforge.net] On
> Behalf Of Alexander Golub
> Sent: Monday, February 06, 2006 5:21 PM
> To: itext-questions (at) lists.sourceforge.net
> Subject: [iText-questions] Question about "IRT" entry for
> markup annotations.
>
> Hello, friends.
>
> I've encountered the situation, when PDF document contains
> text annotation with reply. As you definitely know, reply is
> the annotation too, but it is rendering in the same area as
> annotation the given reply is dirrected to and text of reply
> is shown within popup window of "parent" annotation.
>
> As you again definitely know, reply annotation is connected
> to "parent" annotation via "IRT" entry from markup
> annotations dictionary. This entry is either text string
> which refers to an entry "NM" of parent annotation, or
> indirect reference to parent annotation.
>
> What I have : I have original PDF file without annotations
> (file 1) and PDF file with two text annotations, one of which
> has a "reply-to" connecion to another (file 2); file 2 was
> obtained from file 1 by adding these two annotations.
>
> What do I want : using iText library, I want to read all
> annotations from file 2 and, basing on file 1, create another
> file - PDF file which will contain all annotations from file
> 2 appended to the file 1. Kinda copy, although technically it
> is not a copy.
>
> I've successfully obtained annotations from file 2, and I've
> added them to a file 3; now I have to link one annotation as
> reply to another one.
> When reply annotation is referring to a parent annotation via
> "NM" entry, I can handle this successfully like in the
> following code snippet (regardless of restrictions by page):
> ...
> PdfStamper stamper = new PdfStamper("file1.pdf", "file3.pdf");
> ...
> PdfAnnotation parent =
> PdfAnnotation.createText(stamper.getWriter, getRectangle(),
> getContent(), isOpened1(), getName());
> PdfAnnotation reply =
> PdfAnnotation.createText(stamper.getWriter,
> getRectangleReply(), getContentReply(), isOpenedReply(),
> getNameReply());
> ...
> reply.put(new PdfName("IRT"), new
> PdfString(getParentAnnotationUniqueName));
>
> But when reply annotation is connected with parent annotation
> via indirect reference, I cannot to do the same trick with
> put() method - I don't have access to an indirect reference
> of parent annotation.
>
> I can see from code, that similar situation with relation by
> reference for "parent-popup" pair was encountered. Situation
> was resolved via the PdfAnnotation's method setPopup(), in
> which an internal package method getIndirectReference() was used.
>
> To achieve my goal, I use the following workaround : within
> package "com.lowagie.text.pdf" I create a class
> PackageMethodsAccessor with a single static method, which has
> an access to a package method getIndirectReference(), which
> is used in the PdfAnnotation's setPopup() method:
>
> public class PackageMethodsAccessor
> {
> public static PdfIndirectReference
> getIndirectReference_PdfAnnotation(PdfAnnotation annotation)
> {
> return annotation.getIndirectReference();
> }
> }
>
>
> I know that it is not correct technique and it is a hack. But
> can you tell me - is there a legal approach of setting
> relation "annotation"-"reply to annotation" in the iText? If
> there is no such method, is it possible to provide means of
> interconnection of such reply annotations within next library ?
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions