Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 227189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:34:39+00:00 2026-05-11T19:34:39+00:00

I was wondering how to convert a file I have on my server (pdf/excel/ppt)

  • 0

I was wondering how to convert a file I have on my server (pdf/excel/ppt) to a ByteArray. The reason I want to do this is to display the dialogue open/save as to the user and I must set the Content-Type to octet-stream. The dialogue shows fine with just navigateToURL() but for pdf’s it is the user’s local browser setting. For a URLRequest I must set the data as a ByteArray. I’m trying to use the code located here:

Custom printing with Flex

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:34:40+00:00Added an answer on May 11, 2026 at 7:34 pm

    Provided you’re targeting Flash Player 10, this should work:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="loadFile()">
    
        <mx:Script>
            <![CDATA[
    
                private var loadedFile:ByteArray;
    
                private function loadFile():void
                {
                    var request:URLRequest = new URLRequest("http://test.enunciato.org/sample.pdf");
                    var urlLoader:URLLoader = new URLLoader(request);
    
                    urlLoader.addEventListener(Event.COMPLETE, onURLLoaderComplete);
                    urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
                    urlLoader.load(request);
                }
    
                private function onURLLoaderComplete(event:Event):void
                {
                    loadedFile = event.target.data;
                }
    
                private function saveLoadedFile():void
                {
                    var file:FileReference = new FileReference();
                    file.save(loadedFile, "SampleDoc.PDF"); 
                }
    
            ]]>
        </mx:Script>
    
        <mx:Button label="Save Image" horizontalCenter="0" verticalCenter="0" click="saveLoadedFile()" />
    
    </mx:Application>
    

    Assuming you load the file first — in this example, the load operation happens on creationComplete, and the bytes get stored off in loadedFile — the bytes should be and ready for saving when the user clicks Save Image. Tested and verified the example works. Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering how can convert CGcolorRef to UIColor ? I have created a
I was wondering if anyone knows how to automatically convert PDF's to JPGs in
We have a requirement where we need to convert from .wav file to .mp3
I have a project where I need to convert a XML file to CSV
I am just wondering is there a way to convert nib/xib file to ojbective
I was wondering if anyone knew how to convert an mp3 audio file to
Is there a way to convert a xls file into a pdf ? I
I was wondering and have not found any advice, on how to convert a
I have a .CSV file and was wondering if there is any process on
Hey, I'm just wondering how to convert a numerical date into text format in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.