I suspect we are actually dealing with two problems. I've isolated the test case by creating the large HTML file that is to be converted to PDF using PD4ML and verified that it works in my IDE (Eclipse) When trying to convert the file using the exact same code as Notes agent it fails with the following dump: (Kindly read until end as there is more explanation after the dump)
Code:
BlockElement(body) {line-height=1.2000000476837158, font-family=[Ljava.lang.String;@662f662f, display=block, width=900, margin-left=10, margin-top=0, margin-bottom=8, margin-right=8, font-size=16}
ContentElement(pd4content) [ ] {line-height=1.2000000476837158, font-family=[Ljava.lang.String;@662f662f, display=block, font-size=16}
ContentElement(pd4content) [ ] {line-height=1.2000000476837158, font-family=[Ljava.lang.String;@662f662f, display=block, font-size=16}
com.sun.media.jai.codecimpl.util.ImagingException
at com.sun.media.jai.codecimpl.ImagingListenerProxy.errorOccurred(ImagingListenerProxy.java:71)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:218)
at com.cmti.pdfgen.TiffImageLoader.readAndConvertTiff(TiffImageLoader.java:87)
at com.cmti.pdfgen.TiffImageLoader.getResourceAsBytes(TiffImageLoader.java:62)
at org.zefer.cache.ResourceCache.getObjectAlternativeWay(Unknown Source)
at org.zefer.cache.ResourceCache.getObject(Unknown Source)
at org.zefer.cache.ResourceCache.getObject(Unknown Source)
at org.zefer.cache.ResourceCache.getImage(Unknown Source)
at org.zefer.html.doc.n.thisvoid(Unknown Source)
at org.zefer.html.doc.n.Õõ0000(Unknown Source)
at org.zefer.html.doc.n.if(Unknown Source)
at org.zefer.html.doc.b.b.o00000(Unknown Source)
at org.zefer.html.doc.ab.o00000(Unknown Source)
at org.zefer.html.doc.b.d.o00000(Unknown Source)
at org.zefer.html.doc.ab.o00000(Unknown Source)
at org.zefer.html.doc.Document.layout(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at PD4MLOnlyTest.render(PD4MLOnlyTest.java:40)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Caused by: com.sun.media.jai.codecimpl.util.ImagingException: IOException occurs when encode the image.
... 22 more
Caused by: java.io.IOException: reading encoded JPEG Stream
at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:484)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:240)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:215)
... 21 more
Caused by:
com.sun.media.jai.codecimpl.util.ImagingException: IOException occurs when encode the image.
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:218)
at com.cmti.pdfgen.TiffImageLoader.readAndConvertTiff(TiffImageLoader.java:87)
at com.cmti.pdfgen.TiffImageLoader.getResourceAsBytes(TiffImageLoader.java:62)
at org.zefer.cache.ResourceCache.getObjectAlternativeWay(Unknown Source)
at org.zefer.cache.ResourceCache.getObject(Unknown Source)
at org.zefer.cache.ResourceCache.getObject(Unknown Source)
at org.zefer.cache.ResourceCache.getImage(Unknown Source)
at org.zefer.html.doc.n.thisvoid(Unknown Source)
at org.zefer.html.doc.n.Õõ0000(Unknown Source)
at org.zefer.html.doc.n.if(Unknown Source)
at org.zefer.html.doc.b.b.o00000(Unknown Source)
at org.zefer.html.doc.ab.o00000(Unknown Source)
at org.zefer.html.doc.b.d.o00000(Unknown Source)
at org.zefer.html.doc.ab.o00000(Unknown Source)
at org.zefer.html.doc.Document.layout(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at PD4MLOnlyTest.render(PD4MLOnlyTest.java:40)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Caused by: java.io.IOException: reading encoded JPEG Stream
at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:484)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:240)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:215)
... 21 more
Caused by:
java.io.IOException: reading encoded JPEG Stream
at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:484)
at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:240)
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:215)
at com.cmti.pdfgen.TiffImageLoader.readAndConvertTiff(TiffImageLoader.java:87)
at com.cmti.pdfgen.TiffImageLoader.getResourceAsBytes(TiffImageLoader.java:62)
at org.zefer.cache.ResourceCache.getObjectAlternativeWay(Unknown Source)
at org.zefer.cache.ResourceCache.getObject(Unknown Source)
at org.zefer.cache.ResourceCache.getObject(Unknown Source)
at org.zefer.cache.ResourceCache.getImage(Unknown Source)
at org.zefer.html.doc.n.thisvoid(Unknown Source)
at org.zefer.html.doc.n.Õõ0000(Unknown Source)
at org.zefer.html.doc.n.if(Unknown Source)
at org.zefer.html.doc.b.b.o00000(Unknown Source)
at org.zefer.html.doc.ab.o00000(Unknown Source)
at org.zefer.html.doc.b.d.o00000(Unknown Source)
at org.zefer.html.doc.ab.o00000(Unknown Source)
at org.zefer.html.doc.Document.layout(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at PD4MLOnlyTest.render(PD4MLOnlyTest.java:40)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Exception in thread "AgentThread: JavaAgent" java.lang.OutOfMemoryError
at java.lang.StringBuffer.ensureCapacityImpl(StringBuffer.java:335)
at java.lang.StringBuffer.append(StringBuffer.java:201)
at org.zefer.pd4ml.pdf.c.Ôo0000(Unknown Source)
at org.zefer.pd4ml.pdf.PD4Device.isNewPageNeeded(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at PD4MLOnlyTest.render(PD4MLOnlyTest.java:40)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
I have three copies of the HTML file. One with no images at all and it runs fine in Both Eclipse and as a Notes agent. One with a small (4k) .png image in the header of every other page for a total of 100 images in a 200 page PDF. This also runs to completion in both Eclipse and Notes. The third HTML file has the same header images as the second and 4 TIFF images (one each on the 2nd, 4th, 6th and 8th page of the 200 page PDF output) This file runs fine on Eclipse but fails in the Notes agent with the above dump. The image sizes you requested for TiffImageLoader.getResourceAsBytes are:
Code:
Image URL: file:///C:\Users\XXXXXXXXXX/038/038011074/WS/057008072_WS.TIF
BYTE SIZE: 31982
Image URL: file:///C:\Users\XXXXXXXXXX/028/028009113/WS/041013397_WS.TIF
BYTE SIZE: 48640
Image URL: file:///C:\Users\XXXXXXXXXX/028/028009113/WS/047020674_WS.TIF
BYTE SIZE: 48640
Image URL: file:///C:\Users\XXXXXXXXXX/048/048008877/WS/051006769_WS.TIF
BYTE SIZE: 40704
Note that the TiffImageLoader class is one that you supplied in your examples.