HTML to PDF / DOCX / RTF Java converter library Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ can not load image error when converting from html to pdf

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #27090

    Hello Everyone,
    Image is not displayed while converting from html to pdf.
    I have picked randomly some image from internet like
    http://www.daycomsolutions.com/Support/ … 050w50.JPG
    But I am able to view image when placed in browser.
    what is reason ? How to fix this?
    Any help is appreciated ….Thanks
    #########Content of sample1.html#########


    Hello


    hi friends


    Actual image




    ###################
    ~/Downloads/pd4>java -Xmx512m -Djava.awt.headless=true -cp ./pd4ml_demo.jar:ss_css2-0.9.4_pd4ml2.jar Pd4Cmd ‘file:sample1.html’ 1200 LETTER -bookmarks HEADINGS -pdfforms -debug -out ./pd4ml.pdf
    version: PD4ML 399 (eval)
    default built-in stylesheet parsed [28ms]
    loading file:sample1.html [6ms]
    image not yet in cache: file:sf.jpg
    not yet in cache: file:sf.jpg
    loading file:sf.jpg [0ms]
    image size: 5510
    image not yet in cache: http://www.daycomsolutions.com/Support/ … 050w50.JPG
    not yet in cache: http://www.daycomsolutions.com/Support/ … 050w50.JPG
    loading http://www.daycomsolutions.com/Support/ … 050w50.JPG [26221ms]
    errno: 111 (Connection refused), error: Connection refused (local port 50735 to address 0:0:0:0:0:0:0:0, remote port 80 to address 74.208.20.166): http://www.daycomsolutions.com/Support/ … 050w50.JPG (socket timeout 0ms)
    image http://www.daycomsolutions.com/Support/ … 050w50.JPG has zero length.
    can not load image: http://www.daycomsolutions.com/Support/ … 050w50.JPG
    done in 27878ms.

    Thanks,
    Sudhakar

    #29901

    From the diagnostics it follows, that PD4ML cannot load the image.

    errno: 111 (Connection refused), error: Connection refused (local port 50735 to address 0:0:0:0:0:0:0:0, remote port 80 to address 74.208.20.166): http://www.daycomsolutions.com/Support/ ... 050w50.JPG (socket timeout 0ms)

    Probably your workstation (where PD4ML runs) has no route to the server or there are other network/firewall configuration troubles.

    I would recommend either to investigate the network issue or just for the test purposes to refer to an image, available in your intranet.

    #29902

    If it is a firewall or network issue then image the should not be visible when pasted the link on the web browser.
    But when i paste image url on to the web browser address bar, i can view the image. Also I am able to view the image with the same URL in my web application page(html page).
    May be we need to check how pd4ml jar treats the image resource Url. And in which all cases pd4ml.jar throws this error.
    Let me know if anyone has more information to share in this case.

    Thanks,
    Sudhakar

    #29903

    It is not a 100% proof of problem-less network routing if it works from a web browser: the browser may be configured to access URLs via corporate proxy.

    #29904

    So how to fix this issue when using pd4ml libs?
    Please let me know how to fix this issue in simple steps. Hope there must be some approach to solve this problem.
    We have a paid licence for pd4ml from corporate side. I don’t this just for this reason we need to lookout for some other third party libs. 🙁 🙁
    Awaiting for help.
    Thanks,
    Sudhakar Makam

    #29905

    The diag line explicitly says there are network (firewall or routing) issues:

    errno: 111 (Connection refused), error: Connection refused (local port 50735 to address 0:0:0:0:0:0:0:0, remote port 80 to address 74.208.20.166): http://www.daycomsolutions.com/Support/ ... 050w50.JPG

    The server or workstation where PD4ML runs cannot access HTTP resources of 74.208.20.166. Your network admin should check it and resolve it. If it is not possible by any security reason etc, you need to configure PD4ML to go via your company proxy.

    #29906

    Thanks PD4ML team, how to configure PD4ML to go via company proxy or other means by doing programatically . Any link for some samples.

    PD4ML version used in my project is 370.
    Up on browsing and going through pd4ml guide i found below sample code. But the constant PD4Constants.PD4ML_HTTP_PROXY was introduced in version 371.
    So is there any work around for version 370?
    Map m = new HashMap();
    m.put(PD4Constants.PD4ML_HTTP_PROXY, proxyHost + “:” + proxyPort);
    pd4ml.setDynamicParams(m);

    Thanks in advance.

    #29907

    You can configure your application to use proxy Java-generic way with the following code:

    [language=java:3lf5d9c5]String host=”your.proxy.br”;
    String port=”80″; // change it to your proxy port number

    // older JDK approach
    System.getProperties().setProperty(“proxySet”, “true”);
    System.getProperties().setProperty(“proxyHost”, host);
    System.getProperties().setProperty(“proxyPort”, port);

    // newer JDK approach
    System.getProperties().setProperty(“http.proxySet”, “true”);
    System.getProperties().setProperty(“http.proxyHost”, host);
    System.getProperties().setProperty(“http.proxyPort”, port);[/language:3lf5d9c5]

    The similar can be achieved with a JVM command line parameters:

    -Dhttp.proxySet=true -Dhttp.proxyPort= -Dhttp.proxyHost=

Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.