Jump to content
Search Community
ondras82 test
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

  • 9 months later...
  • 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.
×
×
  • Create New...