Roberto,
I think i had a similar issue this week, wanting to create a print Q, but this code should help you i think?
The mac one is easy, except you need to make sure you specify the correct printer tray and paper, otherwise a light will come on and you will need to press a button on the print.
The windows one, you need to either put a setting in for the path to acrobat or make sure the user has acrobat 9 installed in the normal directories.
I am printing from blob fields, but you can equally print directly from a pdf created in a variable.
I think this should work for you as it doesnt touch the sides as it were.
David
- Code: Select all
var tempFile = plugins.file.createTempFile('printfile','.pdf');
plugins.file.writeFile(tempFile, pdf);
if(utils.stringMiddle(application.getOSName(), 1, 7) == "Windows")
{
//var pathtoacrobat=plugins.dialogs.showInputDialog( 'path to acrobat', 'path to acrobat?', 'C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe' )
application.executeProgramInBackground('C:/Program Files/Adobe/Reader 9.0/Reader/AcroRd32.exe','/t',tempFile.getAbsolutePath())
}
else
{
//send the PDF to the printer
application.executeProgram( '/usr/bin/lpr',tempFile.getAbsolutePath(),"-o","media=a4,tray2");
}