image name == filename? Don't you have a path to the file when you added it to the PDF to begin with?
Leonard On Jun 22, 2008, at 3:20 PM, Anthony Oganesian wrote: > Leonard, > > Thank you for looking into this! I think hashing will work, but I > don't see > how I could use image name? Which API method do I use when > generating PDF > to assign this name? > > Thank you, > Tony > >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:itext- >> [EMAIL PROTECTED] On Behalf Of Leonard >> Rosenthol >> Sent: Sunday, June 22, 2008 7:20 AM >> To: Post all your questions about iText here >> Subject: Re: [iText-questions] image reference for a special >> application >> >> How about putting the name of the image in your URL? Or if you >> really want something unique - use an MD5 or SHA1 hash. >> >> Leonard >> >> On Jun 22, 2008, at 6:32 AM, Anthony Oganesian wrote: >> >>> 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 > ------------------------------------------------------------------------- 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
