Solved

how to use printjob in adobe cs3

Posted on 2011-09-30
5
225 Views
Last Modified: 2012-05-12
Hi, how can I print a form from a flash application. Doing some research here I looked at printjob, but I don't know how to use it either.  I am using Adobe Flash CS3
I wanna be able to print the text from text fields, add titles, some text, etc...
I am using AS2

Any help, recommendation or guide would be greatly appreciated

Thanx
0
Comment
Question by:crescue
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 36894480
Very simple:

_root.createTextField("textField_txt", 1, 10, 10, 200, 25);
_root.textField_txt.text = "Hello World";


var printJob:PrintJob = new PrintJob();
if (printJob.start()) {
      printJob.addPage("textField_txt", null, {printAsBitmap:true}, 1);
      printJob.send();
      delete printJob;
}
                        
0
 

Author Comment

by:crescue
ID: 36895257
I already have the form with fields and everything I want to print. I just want to send that information to the printer, and I am using the code below :
It prints fine with the exception that it prints the PRINT BUTTON too, and I would like to get rid of that button in the printout

Thanx

import mx.controls.Button;
var printBut:Button;
var my_pj:PrintJob;

printBut.onPress = function() {
    // create PrintJob object
      
   my_pj = new PrintJob();
    if (my_pj.start()) {
        if (my_pj.addPage(_root)) {   //_root
            my_pj.send();
        }
    }
};
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36895502
you can on print hide PRINT BUTTON and after printing complete set to visible true
0
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36895602
printBut.onPress = function() {
    // create PrintJob object
     
   my_pj = new PrintJob();
    if (my_pj.start()) {
          printBut.visible = false;
        if (my_pj.addPage(_root)) {
            my_pj.send();
        }
            printBut.visible = true;
    }
};
0
 

Author Closing Comment

by:crescue
ID: 36973996
Thanx
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question