10 Replies Latest reply on Jul 7, 2006 6:32 AM by Peter Lorent

    Print

    FlashAmit
      I am making an application in flash with resolution 1024X768. When I prints from the application it sends the screen size which does not fits on the page. I tried the fit to page option of the printer but does not work out. Can any one suggest how can this be solved. The application run as full screen.
        • 1. Re: Print
          Peter Lorent Level 2
          >>When I prints from the application
          How? Using the context menu, just by printing from the browser, using the PrintJob Class?
          • 2. Re: Print
            FlashAmit Level 1
            The print button is inside the flash application.

            I am using the PrintJob class. I think the solution is set the scale. But this is working when I am printing Movie Clip. Right now I am printing the entire stage area.

            code is this
            var pj = new PrintJob();
            var success = pj.start();
            pj.addPage(0, {xMin:0, xMax:1024, yMin:0, yMax:768});
            //pj.orientation:"landscape";
            pj.printAsBitmap("_level0", true);
            pj.send();

            It prints the stage but cuts the page from bottom and right.

            Please help.....
            • 3. Re: Print
              Peter Lorent Level 2
              If I use the following code:
              function doPrint(){
              var pj:PrintJob = new PrintJob();
              var success = pj.start();
              if(success){
              pj.addPage(0, null, {printAsBitmap:true});
              pj.send();
              } else {
              trace("No printer available or user cancelled the print job.");
              }
              }
              I can set the scale to 70% in the Page Setup window. So, you might want to 'warn' your visitors to set the appropriate scale and orientation before you proceed with the print job.
              • 4. Re: Print
                FlashAmit Level 1
                I tested with two printers this way. Also I try the option "Fit to page" but did not work out. I think this will work with some printers but not all. And this is quite confusing to the client.
                I tested one more option:

                _level0._xscale = 50;
                _level0._yscale = 50;
                pj.addPage(0, {xMin:0, xMax:1024, yMin:0, yMax:768});
                //pj.orientation:"landscape";
                pj.printAsBitmap("_level0", {xMin:0, xMax:1024, yMin:0, yMax:768});
                pj.send();
                _level0._xscale = 100;
                _level0._yscale =100;
                And I did not saw a flicker on the screen.

                Now the two new issues are:
                1. Can I pass a name to the dialog box as the name in case printing to pdf printer?
                2. Can I skip the print dialog box and print directly so that the user does not see printer properties dialog box?

                • 5. Re: Print
                  FlashAmit Level 1
                  I tested with two printers this way. Also I try the option "Fit to page" but did not work out. I think this will work with some printers but not all. And this is quite confusing to the client.
                  I tested one more option:

                  _level0._xscale = 50;
                  _level0._yscale = 50;
                  pj.addPage(0, {xMin:0, xMax:1024, yMin:0, yMax:768});
                  //pj.orientation:"landscape";
                  pj.printAsBitmap("_level0", {xMin:0, xMax:1024, yMin:0, yMax:768});
                  pj.send();
                  _level0._xscale = 100;
                  _level0._yscale =100;
                  And I did not saw a flicker on the screen.

                  Now the two new issues are:
                  1. Can I pass a name to the dialog box as the name in case printing to pdf printer?
                  2. Can I skip the print dialog box and print directly so that the user does not see printer properties dialog box?

                  • 6. Re: Print
                    Peter Lorent Level 2
                    >>pj.printAsBitmap("_level0", {xMin:0, xMax:1024, yMin:0, yMax:768});
                    printAsBitmap should be passed as a parameter (object) to addPage().
                    The following code works for me:
                    var owner:MovieClip=this;//reference to _level0
                    function doPrint(){
                    owner._xscale=50;
                    owner._yscale=50;
                    var pj:PrintJob = new PrintJob();
                    var success = pj.start();
                    if(success){
                    pj.addPage(0, null, {printAsBitmap:true});
                    pj.send();
                    delete pj;
                    owner._xscale=100;
                    owner._yscale=100;
                    } else {
                    trace("No printer available or user cancelled the print job.");
                    }
                    }

                    print_btn.onRelease=doPrint;

                    • 7. Re: Print
                      FlashAmit Level 1
                      Please confirm

                      1. Can I pass a name to the dialog box as the name in case printing to pdf printer?
                      2. Can I skip the print dialog box and print directly so that the user does not see printer properties dialog box?
                      • 8. Re: Print
                        Peter Lorent Level 2
                        1. which dialog box, which name. please clarify
                        2. only if you were using server side software to handle the printjob
                        • 9. Re: Print
                          FlashAmit Level 1
                          1. When I use a pdf creator(e.g. Acrobat) it shows me as a pdf printer in the printers.
                          Now selecting this i want to make a pdf from flash. As I click on the print it shows me a printer setup page. I select the pdf printer then a save as dialog box appears with a default name "Flash.pdf"(in my system). Pressing ok it creates the pdf. I wan this name to be passed from the flash. Its a desktop application exe created using flash(Flash windows Projector).

                          2.>>only if you were using server side software to handle the printjob
                          no middle layer is present. The Exe runs as flash projector on windows full screen.
                          • 10. Re: Print
                            Peter Lorent Level 2
                            1. Then, no, at least not that I know of.
                            2. Then, no.
                            You might want to have a look at a third party tool like FlashJester and more specifically JStart and JPrintor.