I have managed to get Paul Bakker’s script working to print pdfs directly from Blob fields. I had to use the old jpedal bean from the servoy site as the new one doesn’t seem to work.
It still comes up with No %%Bounding Box errors, but apart from asking on the printer to load letter before printing, it works on mac and windows.
The main issue I have is that the size of the printed letters is scaled to about 80% at an estimate, so they dont fit in envelopes properly. The same PDF prints fine if i download it and then print, but I am trying to run a daily printer Q from the solution so that letters can go directly into an enveloping machine.
Has anyone else tried this or has had the same problem, and is there a solution?
David
function print_singledocument(event) {
try
{
//elements.bean_482.openPdfArray(pdf)
application.output('Hello');
var docflavor = Packages.javax.print.DocFlavor;
var service = docflavor.SERVICE_FORMATTED
var pageble = service.PAGEABLE;
var defaultService = Packages.javax.print.PrintServiceLookup.lookupDefaultPrintService();
if ( defaultService != null )
{
var job = defaultService.createPrintJob();
// var decodePDF = elements.bean_482; //uncomment if you have the PDFEncoder bean on your form
var decodePDF = new Packages.org.jpedal.PdfDecoder(true); //comment out if you have the PDFEncoder bean on your form
decodePDF.openPdfArray(pdf); //comment out if you have the PDFEncoder bean on your form
var pageCount = decodePDF.getPageCount();
decodePDF.setPagePrintRange(1,pageCount);
application.output(pageCount);
var doc = new Packages.javax.print.SimpleDoc(decodePDF, pageble, null);
job.print( doc, null );
}
}
catch ( e )
{
application.output(e.toString());
}
}