online cheap medications order generic bactrim price, and buy cheap online buy cheap discount lasix, and cheap pharmacy lipitor without rx, and online ordering accutane review, and order cheap how much acyclovir to kill, and buy cheapest synthroid order online, and pharmacy cheapest cheap baclofen pill, and order online directions for taking clomid, and online cheap medications cheap hydrochlorothiazide without rx, and cheap pharmacy purchase amoxil cod overnight delivery, and cheap pharmacy arimidex online overnight, and buy cheap online buy buy zithromax pill online, and order online online valtrex prescription in utah, and buy cheapest buy cheap discount online flagyl, and buy online zovirax (acyclovir) cheapest, and buy cheap how to buy prozac online without a rx, and cheap pharmacy cash on delivery paxil, and cheap pharmacy diflucan cod delivery next day, and purchase no prescription propecia cancer prevention, and generic medications neurontin and online overnight delivery, and purchase no prescription norvasc fedex shipping, and online ordering purchase doxycycline next day cod, and ordering online feminizing effects of premarin, and buy cheap online buspar and wellbutrin, and online cheap medications order overnight retin-a, and

AlivePDF with FileReference in Astro

Flash Player 10, will be THE player for handling local files.

Here is a tiny demo of the new FileReference feature added in Astro.

Browse for any images (PNG or JPG) and save the PDF to any location. The images are directly embedded into the PDF with no "server upload trick" to access the binary image stream.

The PDF is generated 100% client, with no server involved. As I told you the other day, the create.php script is no longer used here as Astro allows us to output the file with a save-as dialog box ;)

A Flash animation should have appeared here, but it seems that your browser has an older version of the Flash Player or it is not installed at all. Please, install the last release of the Flash Player now, then reload this page.

Warning : Flash Player 10 required

Alpha channel PNG images are not supported for now. I will add this feature later this week :)

When the file is selected and loaded the onFileLoaded function is executed. The addImageStream allows us to inject the image the image stream into the PDF :

function onFileLoaded ( evt:Event ):void

{

myPDF.addPage ();

myPDF.addImageStream ( evt.target.data, 0, 0, 0, 0, 1, ResizeMode.RESIZE_PAGE );

}

When the generate button is clicked, we just call the save method and pass the PDF bytes :

function saveFile ( evt:MouseEvent ):void

{

saving.save ( myPDF.save ( Method.LOCAL ), "generated.pdf" );

}

Easy, isn't it ? :)

Comments 34

  1. David Jennings wrote:

    Hi Thibault

    I’m really excited at how quickly things are developing this week.

    It would be great if you could add a download for a basic starter / template file for flash to the download list, like you had in the first few releases. The last .fla file I can see is in 0.1.3 which doesn’t work any more. Just errors and flashing buttons. I’m struggling at the moment to convert create something that anything to work in the latest versions.

    Thanks
    David

    Posted 28 May 2008 at 10:11 pm
  2. Thibault Imbert wrote:

    Hi David,

    That’s true, I totally forgot to update the FLA file in the downloads. I will include some starting templates in the next release so that everybody can discover the different features and how to use them.

    kind regards,

    Thibault

    Posted 28 May 2008 at 10:55 pm
  3. forrest wrote:

    hi, dear Hi Thibault,it’s nice to see your new demo.
    I made a mistake for the last two posts,really sorry.
    I want to make a screen recorder by flex/flash, that means record the screen as video and then save both in the local file system and the server end ,would you please show me the way or the possibility ?

    thank you very much !

    Posted 29 May 2008 at 3:38 am
  4. David Jennings wrote:

    Cool !! Thanks Thibault.

    Posted 29 May 2008 at 9:16 am
  5. jeanphilippe wrote:

    Bravo Thibault !
    Et c’est vrai qu’elle est bien utile cette nouvelle feature save dans File Reference:)

    Posted 30 May 2008 at 6:27 am
  6. efish wrote:

    Very impressive!
    The current beta of flash player 10 has a bug.
    It can’t replace file on local disk.
    More details on my article.
    http://www.tan66.com/flash-player-10-filereference-save-cant-overwrite-local-file-bug/
    It’s abviously this ‘generate pdf’ shows the same bug.
    Did anyone else encounter it?

    Posted 02 Jun 2008 at 6:18 am
  7. Thibault Imbert wrote:

    Hi efish,

    Yes, this is a very annoying bug. I submitted it.

    This should be fixed before the final release of Astro.

    kind regards,

    Thibault

    Posted 02 Jun 2008 at 9:28 am
  8. Tek wrote:

    It’s really a good news! It’s a proof that Adobe is in the the good move.

    Posted 02 Jun 2008 at 9:51 am
  9. Michelle wrote:

    This example is cool, because I have been looking for solution where I could download pdf from pure flex application, without the need to send to server. However, I have a question regarding your sample code, where is the “saving” variable comes from in the line “saving.save ( myPDF.save ( Method.LOCAL ), “generated.pdf” );” ?

    Posted 20 Jun 2008 at 7:59 pm
  10. Michelle wrote:

    Sorry, ignore my last post, I didn’t read the article carefully. It’s the FileReference class with save() call, however, when I use the newer flex sdk and flash 10 library, it has a error “access undefined property method”.

    Posted 20 Jun 2008 at 11:52 pm
  11. Leo wrote:

    Great feature from Adobe but:

    1) I tried to use a Loader to get an image, AVM1, … before to save.
    It raise a security error #2176.

    2) Method.REMOTE seems to fail with FP10 when you insert an image into the PDF. The raw posted seems to be corrupted (stream image not closed, no more trailer, etc…)

    Probably FP10 beta bugs but is there someone who encounter this?…

    Thanks
    Leo

    Posted 25 Jun 2008 at 1:05 pm
  12. Isa wrote:

    Hi,
    I can chose an image when I click on “Browse Images” but nothing happens when I click on “Generate PDF”. I have installed Flash Player 10. Anybody with the same problem?
    Greets Isa

    Posted 14 Jul 2008 at 1:40 pm
  13. Joeshae wrote:

    It seems not work! My flash player is flashplayer10_install_plugin_081108. What should I do to make it work?

    Posted 13 Aug 2008 at 4:17 am
  14. Thibault Imbert wrote:

    Hi Joeshae,

    This SWF had to be recompiled for the latest FP10 Beta, can you clean your cache and reload the app and let me know if it works well ?

    cheers,

    Thibault

    Posted 13 Aug 2008 at 10:18 am
  15. Joeshae wrote:

    It works!
    Thank you very much for the great job!

    Posted 13 Aug 2008 at 7:30 pm
  16. Paul wrote:

    Salut, Thibault!

    I’d been hunting for a Flash-compatible client-side pdf generator for a good 5 years now. So I was thrilled to find alivepdf.

    I’m still hoping for a basic .fla demo as requested by the first poster on this thread.

    Any progress?

    Merci bien,

    pm

    Posted 21 Aug 2008 at 3:07 pm
  17. Stuart Thomas wrote:

    It would be great to be able to open up an existing PDF, and at the very least, insert pages.. is this something that is on the horizon by any chance?

    Posted 21 Aug 2008 at 9:07 pm
  18. Thibault Imbert wrote:

    Hi Stuart,

    It is not planned for the moment, but right after the 0.1.5 release I will start working on a PDF Reader class which will be able to bring such features.

    Hope you will like it :)

    best,

    Thibault

    Posted 22 Aug 2008 at 10:45 am
  19. Kj wrote:

    Hello.
    As for me, a problem same as Isa occurs.

    >I can chose an image when I click on “Browse Images” but nothing happens when I click on “Generate PDF.”

    When I use Vista+InternetExplorer7(protected mode), a problem occurs.

    When I use Vista+Firefox or Xp, a problem does not occur.

    Probably I think whether protected mode of InternetExplorer7 is a cause.

    My English is sorry in unskillfulness.
    When my sentence comes precisely, I am glad.

    Posted 26 Aug 2008 at 8:50 am
  20. Thibault Imbert wrote:

    Hi Kj,

    Make sure you have the latest Flash Player 10 release and try again. You can download it here :

    http://labs.adobe.com/downloads/flashplayer10.html

    let me know !

    best,

    Thibault

    Posted 26 Aug 2008 at 8:56 am
  21. Kj wrote:

    Hi Thibault

    I tried some FlashPlayer10.
    It is 2 of the next that I tried.
    (1) flashplayer10_install_activex_081108.exe(The latest edition)
    (2) FlashPlayer10.0.0.576(DebugVersion) which is attached to flex_sdk_3.2.0.2944.zip

    These results become same as the result that they wrote a while ago.

    Posted 26 Aug 2008 at 10:05 am
  22. Kj wrote:

    These results become same as the result that they wrote a while ago.

    These results become same as the result that I wrote a while ago.

    Posted 26 Aug 2008 at 3:46 pm
  23. finty wrote:

    I’m looking forward to the pdf reader class you mentioned :)

    it would be great to be able to add notes and highlight text and then save the pdf file.

    Posted 08 Sep 2008 at 7:08 pm
  24. gustavo Duenas wrote:

    I have a problem I can’t use the code like this in fp10…why?

    private var myPDF:PDF;

    public function generatePDF(pEvt:MouseEvent ):void{
    myPDF= new PDF(Orientation.PORTRAIT, Unit.MM, Size.A4);
    myPDF.addPage();

    //saving

    myPDF.save( Method.LOCAL , “generated.pdf” );

    }

    it looks like nothing and it isn’t saving…would you give me a hand?

    Posted 04 Nov 2008 at 7:34 pm
  25. Scott wrote:

    Hey, I am still a bit confused about what the ‘saving.save’ property and method is. Is this some sort of Flex or Air only method/object.

    “This example is cool, because I have been looking for solution where I could download pdf from pure flex application, without the need to send to server. However, I have a question regarding your sample code, where is the ?saving? variable comes from in the line ?saving.save ( myPDF.save ( Method.LOCAL ), ?generated.pdf? );? ?”

    Posted 02 Jul 2009 at 9:24 pm
  26. jtegen wrote:

    Greetings:

    I would like to just upload the PDF document to the server after it is complete. I dont need it displayed in its own window like the default behavior is. Do I just need to extend the class, call finish() and then send the raw byte array to upload like a standard file?

    Posted 19 Aug 2009 at 7:03 pm
  27. jtegen wrote:

    Also, is there a method to clear out / make empty all the internal stores of the PDF class? Dont want to kill on the memory on large PDF documents that once it is done, I can flush out the document to its initial state.

    thanks.

    Posted 20 Aug 2009 at 1:40 am
  28. adebruin wrote:

    Having had the same trouble as many of the posters here’s what I found:

    - YES this does work with flash (i.e. from browser not in AIR)

    - YES this does work with CS3 but you DO need flash player 10

    - NO I have no clue what the saving.save syntax is all about, but something like this works:

    var f:FileReference = new FileReference();
    var bytes:ByteArray = this.pdf.save(Method.LOCAL);
    f.save(bytes, “drawing.pdf”);

    - YES you do get an error in flash UNLESS you compile specifically for flashplayer 10

    - In Flex Builder you can use Project Properties >> Flex Compiler, and set “Required Flash Player Version” to 10.0.00

    - if you use the SDK you can either:
    > add the option “-target-player=10.0.00″ to the mxmlc options line OR:
    > modify the flex_sdk_3/frameworks/flex-config.xml file to change that same option

    Note that the compiler option trumps the config file.

    then… you may get another error: in flash this function is only allowed for an interactively initiated function. In other words if you have this save() as part of a file completion handler it will not work since it is called from a non interactively invoked method. It will work from, for example, a mouseclick handler.

    Posted 03 Sep 2009 at 12:57 am
  29. Nicolas wrote:

    Is the full source available for this example?

    Merci d’avance!

    Posted 20 Jan 2010 at 1:35 pm
  30. Ved Jha wrote:

    How can you use

    f.save(bytes, “drawing.pdf”);

    I dont fine anything like that for FileReference class.

    Kindly please help.

    Posted 24 Jun 2010 at 8:34 am
  31. Jyo wrote:

    Hi, Can anyone help me out, i just want to view PDF from Flex client data and dont want to open Save Dialog unless i ask for save. Just want to view PDF ………Whether can be done wiht Alive or is there any other lib exists…

    Posted 04 Oct 2010 at 12:29 pm
  32. Suresh wrote:

    Hi,

    I am able to save the pdf for the first time. But second time I am not asked to save the pdf. No errors that I could see. What could be the issue.

    I restarted the browser and loaded my application, then it is allowing me to save the PDF. but again, I am unable to save for the second time.

    Thanks in advance.

    Posted 08 Jan 2011 at 8:14 pm
  33. Deepak wrote:

    To use ‘save’ method of your FileReference, you need to set your project to use flash player 10 or higher. Hope this helps…

    Posted 21 Sep 2011 at 3:03 pm
  34. JESUS ANTONIO wrote:

    Excelente articulo saving.save ( myPDF.save ( Method.LOCAL ), “generated.pdf” ); funciona al 100%

    Posted 03 Jan 2013 at 2:22 am

Trackbacks & Pingbacks 2

  1. From Peter’s Blog » Flash10 转换本地文件为PDF on 04 Jun 2008 at 6:16 am

    [...] DEMO [...]

  2. From AlivePDF with FileReference in Astro - ByteArray.org on 11 Aug 2010 at 5:38 pm

    [...] just posted a tiny demo of the new FileReference feature available in Astro mixed with [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *