1

We are using abcpdf(license version) for converting html to pdf. The function we are using of it is - AddImageHtml We are passing the html in string form to this function as

"<html>
<body>
    <img id="imgTest" src="../testImage.png"/>
</body>
</html>"

This image is present on the path, but image is not loading. We tried absolute path for this too as

 "<html>
    <body>
        <img id="imgTest" src="http://www.example.com/testImage.png"/>
    </body>
    </html>"

Can you please guide, if we are doing wrong anywhere or any ref link would be a great help. Thank you so much in advance!

Oxygen
  • 831
  • 4
  • 17
  • 42

1 Answers1

4

The addImageHtml only is designed to render static HTML, and will not retrieve external resources very well.

We work around this by amending all external resources inside the HTML string. For images this is handled by Base64 encoding the binary data and including it instead of a path to the image.

See here for details: http://en.m.wikipedia.org/wiki/Data_URI_scheme

But basically just include it in the SRC attribute.

You could easily make a processor that parses the document looking for the image tags, retrieves them in a web request, and embeds them if you needed.

Tim
  • 2,878
  • 1
  • 14
  • 19