Skip to main content
Known Participant
March 18, 2011
Question

alivePDF, PurePDF and actionscript 3.0

  • March 18, 2011
  • 1 reply
  • 6806 views

Hi there,

I hope someone can help.. I have created a label generator, basicly the first page is a series of questions, the next page is a rosette and results graphic based on the answers given, this has been done with actionscript 3.0 ( the calculation, of  the answers from the form, activating the graphics (movie_clips) etc.). the next stage is to generate a PDF (of the results page with the rosette and results graphic on it) which can be downloaded or sent. on the surface it seems a relatively simple task, however, the more research i do, the larger the iceberg, i seem to encounter..

my first question is: is this acheivable through alivePDF/PurePDF, is it a pure actionscript 3.0 solution and would i need to reference the libraries, and require read/write/execute permissions (on the web server), does it matter as to the operating system of the web server?

are there any tutorials to steer me in the right direction of how to implement such a solution?

Kind regards

Keith

NB if this is in the wrong forum, i do apologize.

This topic has been closed for replies.

1 reply

Community Expert
March 18, 2011

You can certainly generate PDF from Flash using AlivePDF/PurePDF and you can do so all in the client side (no server involved).

conyipAuthor
Known Participant
March 19, 2011

Having done some research today into using the library AlivePDF, one thing that is certain is it is not 100% client side, as you require PHP to create the PDF, please note that the question was about FLASH CS3/CS4 Actionscript 3.0, and not FLEX or AIR Actionscript 3.0. There seems to very little information regarding using AlivePDF in Flash CS3/CS4. anyone with an idea of how to use it to create a PDF that contains movieclilp/graphics..

Community Expert
March 23, 2011

Could you please explain me how to use purepdf to generate pdf?Because I'm new in purepdf.

  I have download the example in .as extension to make table in pdf, but I don't know how to compile the actionscript to generate pdf file. I'm using air application . Thanks


Here's a super rudimentary example to generate a PDF using PurePDF:

// click anywhere

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.FileReference;
    import flash.utils.ByteArray;
   
    import org.purepdf.elements.Paragraph;
    import org.purepdf.pdf.PageSize;
    import org.purepdf.pdf.PdfDocument;
    import org.purepdf.pdf.PdfWriter;
    import org.purepdf.pdf.fonts.BaseFont;
    import org.purepdf.pdf.fonts.FontsResourceFactory;
    import org.purepdf.resources.BuiltinFonts;
   
    public class PurePDFExample extends Sprite {
        public function PurePDFExample():void {
            stage.addEventListener(MouseEvent.CLICK, stageClick);
        }
       
        private function stageClick(e:MouseEvent):void {
            generatePDF();
        }
       
        private function generatePDF():void {
            FontsResourceFactory.getInstance().registerFont(BaseFont.HELVETICA, new BuiltinFonts.HELVETICA());
            var bytes:ByteArray = new ByteArray();
            var writer:PdfWriter = PdfWriter.create(bytes, PageSize.A4);
            var document:PdfDocument = writer.pdfDocument;
            document.open();
            document.add(new Paragraph("Hello World!"));
            document.close();
            new FileReference().save(bytes);
        }
    }
}