5 Replies Latest reply on Aug 27, 2008 4:40 AM by Patrick Leckey

    Insert image into pdf from XML

      Currently, we are using itextsharp to populate pdf fields with values from an xml document. We then save this populated pdf as a new pdf file. So far we have only had text and boolean fields in the xml and everything has been working.

      We would like to know that if we stored image data in an xml file, could we load the image from that data and place it in the pdf file and then display the image in that pdf (at a particular field or location)?

      Also, can the image be stored in the pdf so that the pdf will display the image without an accompanying xml or image file.

      Thank You

        • 1. Re: Insert image into pdf from XML
          Patrick Leckey Level 3
          All of what you are talking about can be done with the PDF format, but not necessarily with iTextSharp. Since it is a 3rd party tool, you'll need to talk to the iTextSharp developers to find out if their tool supports this.
          • 2. Re: Insert image into pdf from XML
            Level 1
            Ok, forget about itextsharp.

            If a pdf has a text field that has image data stored on it (as a string, i guess), is there a javascript that could feed this data to another field (maybe a button or something) to be displayed as an image?

            Of course, I expect that the javascript would have to do some converting from a string to usable image data.

            Do you imagine that this is possible? To convert a string representing an image into an image with javascript. And then have the pdf display this image?

            Thank You

            • 3. Re: Insert image into pdf from XML
              Patrick Leckey Level 3
              As I said before, it is possible.

              As far as doing this with JavaScript - now you're limiting yourself. Converting a string representing an image into usable image data on the JavaScript side would depend entirely on the image source. JavaScript can add images to buttons with the Icon class (it's all detailed in the API Reference) but the data has to be in basic bitmap format (4 channels, 8 bits per channel, interleaved). Anything other than that is out of JavaScript's range.
              • 4. Re: Insert image into pdf from XML
                gkaiseril MVP & Adobe Community Professional
                Have you looked at LiveCycle Designer forms?

                They are XML based.
                • 5. Re: Insert image into pdf from XML
                  Patrick Leckey Level 3
                  True, XFA forms are XML based, but embedding an image via JavaScript wouldn't be any easier with XFA forms since you're still limited to the JS functionality that Acrobat provides.

                  If you workflow would handle a different approach than JavaScript (a plug-in for example) then you would have many more options for both XFA and AcroForms.