Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #26665

    Hi there,

    I dropped down PD4ml to evaluate today for my company for a project we are doing. I am converting an HTML page generated by xsl and everything is working brilliantly. However, I have one issue. I can not get images to render in the PDF.


    all I get during the render is:

    image not yet in cache: http://chcd-images.crcpress.com/00020000-00029999/00023871.png
    not yet in cache: http://chcd-images.crcpress.com/00020000-00029999/00023871.png
    Connection timed out: connect: http://chcd-images.crcpress.com/00020000-00029999/00023871.png

    If you paste the url into any browser you will see it appears instantly, I tried on another random image from the web and go the same problem. I wonder if you can point me in the right direction.

    The code I am using to generate is:
    PD4ML html = new PD4ML();
    html.enableDebugInfo();
    html.setPageSize(new java.awt.Dimension(450, 450));
    html.setPageInsets(new java.awt.Insets(20, 50, 10, 10));
    html.setHtmlWidth(750);
    html.enableImgSplit(false);

    response.setContentType(“application/pdf”);
    response.setHeader(“Content-disposition”, “inline; filename=test4.pdf”);
    if (!request.isSecure()) {
    response.setHeader(“Pragma”, “no-cache”);
    response.setHeader(“Expires”, “-10000”);
    }

    URL base = new URL(“file:E:\temp\testarrr.jsp”);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    html.render(url, baos);

    byte[] result = baos.toByteArray();
    response.setContentLength(result.length);

    ServletOutputStream sos = response.getOutputStream();
    sos.write(result);

    #28826

    I forgot to mention, these images are not the same site as the PDF is being generated. They are being delivered by a different one.

    #28827

    Typical reasons of the issue could be like that:

    there are 3 nodes in the scenario: client browser (A), document/PD4ML server (B), images server (C).

    In regular web browsing scenario A establishes a connection to B to download HTML, and after that to C to download the images.
    A – B
    A – C

    In PD4ML scenario A only establishes a connection to B (to get PDF). In order to produce PDF B connects to C itself to load images.
    A – B
    B – C

    As a rule A has all needed routing info and “knows” how to connect to B and to C even if there is a firewall/reverse-proxy in-between.

    But very often server (B) does not know how to resolve name of image server (C), especially if the name is defined for outside world like images.corporation.com, but within intranet it is known under a paranoid cryptic name i.e. b3462346x.intranet.corporation.com; or when the C is belong to another net, and due to security policy B has no routing to C.

    #28828

    ahh I see-

    In case anyone else has the problem, I have gotten around it by putting the full unc path to the server which servers up the images. Example:

    that has sorted out the issue and the images are rendered.

    Thanks

    #28829

    I guess I’m having a somewhat similar problem, however my images are coming not from an intranet server, but from an Amazon S3 account. Something like: https://s3.amazonaws.com/bucket-name/newsletters/greenlight_013112104444_WX.jpg

    Is it possible to embed images into the PDF from Amazon S3, or will they need to be accessed from the server generating the PDF?

    Thanks!
    Ryan

    #28830

    Your server must be able to establish a TCP/IP connection to https://s3.amazonaws.com/… (probably you’ll need to route HTTP(S) requests from the server via proxy).

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

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.