This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Option to disable all images to load

David H wrote on 2012-05-23:
I have an issue where, on my development environment, not all images from the html are publicly available to PdfCrowd. A normal browser would not care. I do not want to disable all images.

In short: I would like to be able to generate a pdf with only part of the images available to PdfCrowd.
support wrote on 2012-05-24:
Hello,

There is no option in the API which would selectively disable some images.

If some images are missing (i.e. the server returns a 4xx HTTP status code), the API should produce the same PDF output as the browser. If access to images is blocked by a firewall the API may time out.

Please could you post a sample HTML code that exhibits the problem? We will take a look at it.
David H wrote on 2012-05-24:
The html is attached and contains a 1x1 measure pixel at the end which cannot be loaded (501).
support wrote on 2012-05-24:
The domain dai1urlss.devtest.mailplus.nl resolves to a private network IP address (10.0.0.1) and the consequent HTTP request times out on connect (it does not return 501 on our system):
$ curl -I -v --connect-timeout 60 --trace-time 'http://dai1urlss.devtest.mailplus.nl/oe990000181/2JkbtizHyCA9Rit.gif'
09:57:06.092187 * About to connect() to dai1urlss.devtest.mailplus.nl port 80 (#0)
09:57:06.092682 *   Trying 10.0.0.1... Timeout
09:58:06.150180 * connect() timed out!
09:58:06.150271 * Closing connection #0
curl: (28) connect() timed out!


In my opinion, the simplest way to fix this issue at this moment is to replace such private URLs with an empty string before passing it to convertHtml()
David H wrote on 2012-05-24:
I implemented your suggested workaround earlier. I still think PdfCrowd should (be able to) behave like a browser (and create a pdf with the images it can load). I don't see the difference between a 4xx and a timeout, from a user perspective. Thanks for your time.
support wrote on 2012-05-25:
Point taken, thanks for the feedback. We will consider implementing this in future updates.
tommcquarrie wrote on 2014-07-29:
If you want your dev server images to be ignored by pdfcrowd, one option is to use relative protocol urls like "//dai1urlss.devtest.mailplus.nl/oe990000181/2JkbtizHyCA9Rit.gif" (exclude the "http:"). relative protocol urls are designed so the same image will work over http and https connections without errors, but pdfcrowd doesnt support them, so if you do that, the images will display when viewed as a web page within your dev environment, but will be completely ignored by pdfcrowd.
VernaShield wrote on 2017-11-04:
hi,

There is no option in the API which would selectively disable some images.
support wrote on 2017-11-05:
Hi,

With the new Beta API you can use the following classes in your HTML code which hide/remove elements from the output:
pdfcrowd-remove - sets display:none on the element
pdfcrowd-hide - sets visibility:hidden on the element

Or you can use custom JavaScript to do wanted actions.
-- https://pdfcrowd.com/api/html-to-pdf-php/#set_custom_javascript