Posted By

chrisaiv on 02/08/08


Tagged

as3 printing


Versions (?)

Who likes this?

12 people have marked this snippet as a favorite

shoffa
pixeldata
Akuma99
outbox
visuallyspun
THEPWN3R
enajenkins
johnwun
codyo
tspitzr
adrianparr
swfgeek


AS2: Flash Printing Basics


 / Published in: ActionScript
 

Random notes on how to execute a Print function

  1. var myPrintJob:PrintJob = new PrintJob();
  2. var result:Boolean = myPrintJob.start();
  3. if (result) {
  4. myPrintJob.addPage("invitation_mc", {xMin:30, xMax:250, yMin:27, yMax:300}, {printAsBitmap:true}, 2);
  5. myPrintJob.addPage("map_mc", null, {printAsBitmap:false}, 1);
  6. myPrintJob.addPage(1, null, {printAsBitmap:true}, null);
  7. myPrintJob.addPage("guestList_mc", null, {printAsBitmap:true}, 4);
  8. for(i = 1; i <= myMovieClip_mc._totalframes; ++1){
  9. myPrintJob.addPage("myMovieClip_mc", null, null, i);
  10. }
  11. myPrintJob.send();
  12. delete myPrintJob;
  13. } else {
  14. //User does not have printer or user canceled print action
  15. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: gerryvye on January 6, 2009

if(pj.start()) will not only invoke the start method but also produce a boolean in one line which reduces the total amount of code

if(myPrintJob.start()){

etc...

}

Posted By: naisanza on July 7, 2009

Not good enough to understand all that.. but would creating a button called PrintJob execute the code?

-Eric

Posted By: chrisaiv on October 20, 2009

I highly suggest you give this a look. http://alivepdf.bytearray.org/

Posted By: kmoth on February 25, 2011

This isn't AS3 at all?!

Posted By: chrisaiv on March 23, 2011

kmoth, good point. Thanks for the catch.

You need to login to post a comment.