Hi All
I am using the following code to print/stream a report to pdf on disk.
var file = plugins.file.createTempFile('JobCards','.pdf')
var pdf = (forms.fabman_rpt_budgeting_jobcard.controller.print(false,false,plugins.pdf_output.getPDFPrinter(file.getAbsolutePath())));
Also I have a calculation which is grabbing an image for each record from the app server and putting it into each page of the report using the following
if (image_file_path!=null)
{
var imgURL = application.getServerURL()+'/uploads'+image_file_path.split(' ').join('%20')
var imgTemp = plugins.http.getMediaData(imgURL);
return imgTemp;
}
I get the following in my console when running from smart client on a test app server
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError:
Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.io.ByteArrayOutputStream.write(Unknown Source)
at java.util.zip.DeflaterOutputStream.deflate(Unknown Source)
at java.util.zip.DeflaterOutputStream.write(Unknown Source)
at java.io.FilterOutputStream.write(Unknown Source)
at com.lowagie.text.pdf.PdfStream.flateCompress(Unknown Source)
at com.lowagie.text.pdf.PdfImage.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.addDirectImageSimple(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.addDirectImageSimple(Unknown Source)
at com.lowagie.text.pdf.PdfContentByte.addImage(Unknown Source)
at com.lowagie.text.pdf.PdfContentByte.addImage(Unknown Source)
at com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)
at com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)
at com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)
at com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)
at javax.swing.ImageIcon.paintIcon(Unknown Source)
at com.servoy.j2db.util.gui.MyImageIcon.paintIcon(MyImageIcon.java:317)
at javax.swing.plaf.basic.BasicLabelUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at com.servoy.j2db.smart.dataui.AbstractScriptLabel.paintComponent(AbstractScriptLabel.java:160)
at javax.swing.JComponent.printComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at com.servoy.j2db.smart.dataui.AbstractScriptLabel.paint(AbstractScriptLabel.java:240)
at javax.swing.JComponent.print(Unknown Source)
at com.servoy.j2db.smart.dataui.AbstractScriptLabel.print(AbstractScriptLabel.java:215)
at javax.swing.JComponent.printAll(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.printChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.print(Unknown Source)
I was under the impression that when using a pdf printer with a file name, that the report is streamed to disk, however I am getting out of memory errors when trying to print more than a handful of records.
The images are no bigger than 1 mb each.
Am I doing something wrong?
Any help would be much appreciated.