Solved

Print external file with flash

Posted on 2006-10-31
3
1,419 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

757 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

18 Experts available now in Live!

Get 1:1 Help Now