PrintJob is sent to the printer even though I never called send ()

I need to do print in as3, obviously flash.printing.PrintJob , but I have a problem with it.

I need to check that the settings given by the user in the print dialog shown by PrintJob.start () match some of the ones stored in the database, and there is no way to get this information other than calling PrintJob.start ().

If the page parameters are invalid I never call either addPage () or send (), but after a few seconds (15 aprox) a blank document is printed.

Any idea? How can I cancel a PrintJob? AIR has PrintJob.terminate () but I'm targeting flash.

Thank!

+3


source to share


1 answer


I'm a bit confused as to what you are actually trying to do, but can you do it like this? (from printjob docs, run function example)

var myPrintJob:PrintJob = new PrintJob();
if(myPrintJob.start()) {
// addPage() and send() statements here
}

      

This way you can check the settings if you don't send () it really shouldn't print. (are you sure you're not posting somewhere in the old place in your code?) A possible fix (although not the best, it should work) is to force the printjob reset if its settings don't match your preference, e.g .:



myPrintJob = new PrintJob();

      

If the above does not help, please provide snippets and details. Good luck!

0


source







All Articles