Apologies guys, but I’ve come across a printing issue with the ‘Save Only’ profile.
When setting a Terminal with Print Save Printer(PDFCREATOR printer (Save only profile) is assigned) when going to print a report on report page, it saves the pdf as what it’s supposed to do, but it doesn’t print anything.
The profile does forward the document to be printed to ReceiptPOS1(ticket printer) but nothing actually gets printed. I tried changing Printer Type to RAW printing, It prints a report that has like very little information. such as the one below
but anything that has more information then that, it just prints a blank page.
I tried different printer types, even the default ESC/POS type, but ESC/POS type wouldn’t print, and RAW printed blank, Windows print, didn’t print at all, document print brought an error.
I was therefore had to put terminal 1 report printing back to ticket printer one(receiptPOS1).
It prints and sends work period report fine when you end work period(because of the rule we created). But if I set terminal to PDF creator printer, it would create but not print(maybe not supported, or I may be missing something)
Is there any rule that I can make that would slightly make a change to when “Print” is clicked in reports?
I’d probably make a rule so that when print is clicked, it would make a print to both printers, one for ticket printer and the other for PDFcreator printer(the save only profile)
function sleep(milliseconds)
{
var currentTime = new Date().getTime();
while (currentTime + milliseconds >= new Date().getTime()) {
// do nothing
}
return milliseconds;
}
function printPDF(f)
{
var tmout = 5;
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var objShell = new ActiveXObject("Shell.Application");
var WshShell = new ActiveXObject("WScript.Shell");
var filename = f;
if(!objFSO.FileExists(filename))
{
return "File does not exist: " + filename;
}
try
{
var PDFCreatorQueue = new ActiveXObject("PDFCreator.JobQueue");
PDFCreatorQueue.Initialize();
//Since we are using the "DefaultGuid" pdf is our output format
var fullname = objFSO.GetFileName(filename);
var name = fullname.replace(objFSO.GetExtensionName(fullname),"pdf");
var fullPath = objFSO.GetParentFolderName(filename) + "/" + name;
// invoke associated program and call it's "print" verb
objShell.ShellExecute(filename,"", "", "print", 2);
// call our sleep function
var sleeping = sleep(500);
// send ENTER key
WshShell.SendKeys('{ENTER}');
if(!PDFCreatorQueue.WaitForJob(tmout))
{
PDFCreatorQueue.ReleaseCom();
return "The print job did not reach the queue within " + tmout + " seconds";
}
else
{
var job = PDFCreatorQueue.NextJob;
job.SetProfileByGuid("DefaultGuid");
//Assuming you want to convert to a .tif-file you can do this by
//simply changing the output format setting of your current profile
//job.SetProfileSetting("OutputFormat", "Tif");
job.SetProfileSetting("OutputFormat", "Pdf");
//Get the guid of the used profile
var guid = job.GetProfileSetting("Guid");
job.ConvertTo(fullPath);
if(!job.IsFinished || !job.IsSuccessful)
{
PDFCreatorQueue.ReleaseCom();
//WScript.Echo("Could not convert the file: " + fullPath);
return "Could not convert the file: " + fullPath;
}
else
{
PDFCreatorQueue.ReleaseCom();
//WScript.Echo("Job finished successfully");
return "Success";
}
}
PDFCreatorQueue.ReleaseCom();
}
catch(e)
{
PDFCreatorQueue.ReleaseCom();
return "ERROR: " + e.message;
}
}
Here is the Rule I use which is fired when I click a button…
This actually uses the Save Report Action, then uses JScript to convert. The reason I like the Save Report Action is that it allows us to specify the FileName, so we have full control over it. You could add one more Action to Send Email with attachment at the end of it all.