Add image to PDF from a URL?

10,825

This is a known issue when loading .gif from a remote location with iText.

A fix for this would be to download the .gif with Java (not via the getInstance method of iText's Image class) and to use the downloaded bytes in the getInstance method of the Image class.

Edit: I went ahead and fixed remote gif loading in iText, it is included from iText 5.4.1 and later.

Share:
10,825
riahc3
Author by

riahc3

Programmer that hates programming

Updated on June 04, 2022

Comments

  • riahc3
    riahc3 almost 2 years

    Im trying to add a image from a URL address to my pdf. The code is:

    Image image=Image.getInstance("http://www.google.com/intl/en_ALL/images/logos/images_logo_lg.gif");
    image.scaleToFit((float)200.0, (float)49.0);
    paragraph.add(image);
    

    But it does not work. What can be wrong?