I want to convert some HTML content into a PDF file. The problem I’m facing is that the HTML content has some <img> tags with absolute image urls. Hence the
HTMLWorker.parse()
method throws following exception in case there is no network connectivity.
ExceptionConverter: java.net.UnknownHostException: xyz.com
Is there a way to avoid this exception in such case and generate a pdf without any image?
I’m using iText-5.0.5 library.
You should implement your ImageProvider and when there is a problem retrieving the image just return null, like
Then you should use the HTMLWorker with this provider