Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Images not loading in PDF Export

    We are printing to PDF via RPCManager.exportContent() and I've noticed that when deployed to JBoss 6.0 the image content that was on the page isn't being included in the PDF. I see the errors below in the server log. This happens in all browsers. The software version is:

    SmartClient Version: SNAPSHOT_v8.3d_2012-10-01/Enterprise Deployment (built 2012-10-01)

    Code:
    2012-10-02 14:46:04,280 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,280 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in main path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/fpo/sc/skins/Jeppesen/images/icon-cg-envelope-landing-small.png (No such file or directory). Searching in alternative paths
    2012-10-02 14:46:04,280 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,280 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in any alternative path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/theme/fpo/images/icon-cg-envelope-landing-small.png (No such file or directory)
    2012-10-02 14:46:04,289 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,289 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in main path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/fpo/sc/skins/Jeppesen/imageshttp:/denjpdcd5:8080/fpo/map?number=0&planId=16410&date=1349189142819 (No such file or directory). Searching in alternative paths
    2012-10-02 14:46:04,289 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,289 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in any alternative path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/theme/fpo/imageshttp:/denjpdcd5:8080/fpo/map?number=0&planId=16410&date=1349189142819 (No such file or directory)
    The first image in the error was loaded into the UI with:

    Code:
    Img ldwIcon = new Img("icon-cg-envelope-landing-small.png", 16, 16);
    This image is in the war projects src/main/webapp/images folder.

    And the other image was loaded similarly:

    Code:
    final Img image = new Img(imageUrl);
    the imageUrl points at a servlet to return the image.

    The images load fine into the UI, and also when doing an html print preview via Canvas.showPrintPreview().

    Is there something I need to do to get these images to print in the PDF, or is this a bug?

    Thanks,
    Chris

    #2
    Images should be being included in the generated PDF.
    We have just run some tests to ensure this is working properly and it's working for us.

    We'd love to help get to the bottom of this but we'll probably need to see the problem in action.
    The best way to proceed would probably be to put together a simple small test case we can actually run on our end that demonstrates the issue.

    If you can do this and then show us:
    - runnable code (probably a simple standalone EntryPoint class - the simpler the better - just the components that are relevant to this behavior ideally)
    - the "bootstrap" HTML file the browser actually hits
    - your .gwt.xml file
    - a description of where in your filesystem your image file resides.

    This will probably give us enough information to determine why this isn't working as expected.

    Thanks
    Isomorphic Software

    Comment


      #3
      I tried building a small test app to replicate the problem, and of course it works.

      I'm wondering if the issue may be related to the fact that I'm using a customized skin, and an additional style sheet specific to my project.

      The extra stylesheet is defined in my server.properties:

      skin.Jeppesen.extraStyleSheet: theme/fpo/fpo.css

      What is interesting is that the ResourceLoader is mangling the addresses of the images. I'm attaching the log where it sends the HTML from the page for RPCManager.exportContent() call. The log is split into three files, as the attachment manager would only allow text files smaller than 35kb, and no zip files. They are div1.txt, div2.txt and div3.txt. You'll need to cat these three files together to get the html that was logged.

      In there you can see the "img src=" tags that point to the correct image url. Below is a snippet from the logs showing the ResourceLoader mangling the location of the file it is trying look up.

      Code:
      2012-10-02 14:46:04,280 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,280 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in main path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/fpo/sc/skins/Jeppesen/images/icon-cg-envelope-landing-small.png (No such file or directory). Searching in alternative paths
      2012-10-02 14:46:04,280 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,280 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in any alternative path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/theme/fpo/images/icon-cg-envelope-landing-small.png (No such file or directory)
      2012-10-02 14:46:04,289 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,289 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in main path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/fpo/sc/skins/Jeppesen/imageshttp:/denjpdcd5:8080/fpo/map?number=0&planId=16410&date=1349189142819 (No such file or directory). Searching in alternative paths
      2012-10-02 14:46:04,289 INFO  [STDOUT] (http-169.143.9.79-8080-5) 2012-10-02 08:46:04,289 [http-169.143.9.79-8080-5] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in any alternative path. Error: /export/home/webadm/jboss-6.0.0.Final/server/default/tmp/vfs/automount41deb1dbf2490857/fpo.war-9f58a38f67d789e5/theme/fpo/imageshttp:/denjpdcd5:8080/fpo/map?number=0&planId=16410&date=1349189142819 (No such file or directory)
      The first two lines show it trying to find "http://denjpdcd5:8080/fpo/images/icon-cg-envelope-landing-small.png" in /fpo/sc/skins/Jeppesen/images, which it is not. This image file is in the webapp/images directory.

      The next two lines show it trying to load the <img_src='http://denjpdcd5:8080/fpo/map?number=0&planId=16410&date=1349189142819' tag as fpo/sc/skins/Jeppesen/imageshttp:/denjpdcd5:8080/fpo/map?number=0&planId=16410&date=1349189142819, which is clearly not going to be found. This image URL points at a servlet in the war.

      Any idea why the mangling would occur?


      I've attached our Main.html and our gwt.xml file.
      Attached Files

      Comment


        #4
        I have figured out why images weren't loading into the PDF generated on our JBoss instance. I attached a debugger to the appserver and stepped through the guts of the isomorphic code, and found that were we getting connection refused errors trying to get the images. It turns out that the JBoss instance wasn't bound on startup to all network address, just the machine address. When starting JBoss, it takes an option -b ipaddress, and it needs to be started with -b 0.0.0.0 to get it to listen on the loopback port 127.0.0.1, and the machine's network address.

        It would be helpful if the isomorhpic log output showed the connection refused exceptions instead of the cryptic and misleading error messages.

        Comment


          #5
          Great to hear you got to the bottom of the problem.
          We'll look into whether we can improve the debugging info provided in this scenario for the future.

          Thanks
          Isomorphic Software

          Comment

          Working...
          X