Solved

Print external file with flash

Posted on 2006-10-31
3
1,420 Views
Last Modified: 2013-11-18
I have a button in my flash movie and I want it to print an external .pdf file.

right now this is the code I have but it is just printing the current movie.

Any help is really appreciated thank you,

on (release) {
      print("Page_01.pdf", "bmax");
}
0
Comment
Question by:paulmmalone
  • 2
3 Comments
 
LVL 13

Expert Comment

by:AngryBinary
ID: 17885539
Flash is not capable of sending external files to your print spool on its own. This functionality is supplied by third party Flash wrappers, such as mProjector, which has a convenient method called "printDocument". If it isn't practical to purchase an mProjector license for your specific needs, you can either attempt to reproduce the document in flash and print the movie clip (using the print method or PrintJob class), or simply call the PDF up into a browser window for printing with getURL, since most users have a PDF plugin installed.

As a side note, you can print pages loaded in a separate frame via javascript. There is also an IE specific meta tag that allows you to specify an alternate page to print. While that might not be compliant enough to represent a viable solution, here is a little more info:

http://www.dynamicdrive.com/dynamicindex9/printstyle.htm

Cheers
--Randall
0
 

Author Comment

by:paulmmalone
ID: 17889147
What about dynamically bringing a jpg into flash in a movie clip.  Then printing that movie clip.
Does anyone have an action script example of this.  Please.
0
 
LVL 13

Accepted Solution

by:
AngryBinary earned 500 total points
ID: 17891013
That should be very possible:

var pictureClip = _root.createEmptyMovieClip("pictureClip", 0);
var jpgPath = "./somePic.jpg";
var loaderListener = new Object();
var picLoader = new MovieClipLoader();
var printJob = new PrintJob();

loaderListener.onLoadError = function()
{
    trace("Error on load");
}

loaderListener.onLoadInit = function()
{
    _root.StartPrint();
}

picLoader.addListener(loaderListener);
picLoader.loadClip(jpgPath, pictureClip);

function StartPrint()
{
    if(printJob.start() && printJob.addPage(pictureClip))
    {
        printJob.send();
    }
    else
    {
       trace("Error printing!");
    }
}
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
(URGENT) Help HTML and CSS Resizing Images 2 39
increase words that display in widget 6 56
Handling onsession end function in Application.cfc 5 43
Firebug on Firefox 50 2 67
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

932 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now