Jump to content
GreenSock

ondras82

Load PDF file

Moderator Tag

Recommended Posts

Hello,
I need load PDF file and show as bitmap in Flash (AS3).
I found this code in documentation, but I don´t know how transform byteArray to bitmap?

Can somebody help me please?
 

var loader:BinaryDataLoader = new BinaryDataLoader("files/dum.pdf",{name:"filePDF",requireWithRoot:this.root,estimatedBytes:6800});
loader.load();
 
var files:Array = ["files/dum.pdf"];
LoaderMax.registerFileType("pdf", BinaryDataLoader);
LoaderMax.activate([binaryDataLoader]);
 
var queue:LoaderMax = LoaderMax.parse(files,{onProgress:progressHandler,onComplete:completeHandler,onChildFail:childFailHandler});
queue.load();
 
function completeHandler(event:LoaderEvent):void
{
var byteArray:ByteArray = LoaderMax.getContent("filePDF");
 
//  I need bitmap from the PDF file ???
}

...

Link to comment
Share on other sites

I'm not familiar with any ways to convert a PDF into a Bitmap inside the Flash Player at runtime. Sorry. That's definitely not something LoaderMax handles :)

Link to comment
Share on other sites

And is there way how to show loaded PDF file?
 

Link to comment
Share on other sites

Not that I'm aware of, but I'd recommend Googling that because there may be a solution (I just have never heard of one). 

Link to comment
Share on other sites

  • 9 months later...

Best way i've seen is to open PDF in Illustrator, as as an .AI or .EPS, then import that into Flash.

Keep it vector based if your PDF is not rasterized.  If so, then save your PDF as a .jpg.

Link to comment
Share on other sites

  • 3 weeks later...

Hey mate,

 

Directly loading a PDF is not possible in Flash for a multitude of reasons. There are some other options however if you only working with Flash.

 

PDF2SWF:

http://www.swftools.org/

 

Converts a PDF document to SWF pages which you can use in oyur app. Havn't tried this one personally but you might get some milage out of it.

 

If however you are using Adobe AIR, you can load your PDF into a HTML Container and then assuming the system that is running your app has adobe reader installed. It should render the PDF.

var request:URLRequest = new URLRequest("mydoc.pdf");
pdf = new HTMLLoader();
pdf.load(request);
container.addChild(pdf);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×