Solved

Print external file with flash

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

730 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