Dear All,

I am struggling with a very special requirement and would appreciate any
pointers to a solution. My task requires me to:

1. Generate a PDF document with several images [original images are big, so
I scale them to fit a particular layout on the page]
2. Generated PDF file is viewed in a PDF viewer, which is embedded into my
application. This PDF viewer supports interactive features and allows
programmatic handling of Link Annotations. When a user clicks on an image, I
have to open the original image in a new window.


1. So, when I generate my PDF, I do the following:

...
Image img = Image.getInstance(img_byte_array);
img.scaleToFit(dimensionX, dimensionY);
String REFERENCE_ID = F(img)
img.setAnnotation(new Annotation(0, 0, 0, 0, "img://" + REFERENCE_ID));
...

The REFERENCE_ID here should be anything that would help me identify the img
when I parse the PDF in step 2, 
so I am looking for any help on creating the F() function


2. In my event handler which is attached to the embedded PDF viewer, I do
the following:

public void handleAnnotactionClick(Annotation annotation)
{

    ...
    String url = annotation.getURI();
    if (url.startsWith("img://"))
    {
        String REFERENCE_ID = url.substring(6);
        // Here I need to scan the PDF and find the original image stream, 
        // and somehow identify it by the reference key
         
        // 1. I tried scanning using the PdfReader and I am able to find the
PdfStreams with the right subtype,
        //    but once I have the stream I can't figure out any way to
identify the one I need among several
        // 2. I tried using JPedal, but I face the same issue of not being
able to tell one image from another. 
        //    JPedal is using something it calls an ImageName, but that
seems to be assigned by JPedal
    }    

}

Thank you very much in advance for any help!
Tony.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to