AddImage in AlivePDF

I have created the PDF using AlivePDF...works great. I want to add an image to the PDF. I am getting the error "ArgumentError: Error #2015: Invalid BitmapData."
This is my code:
package GUI
    import flash.display.*;
    import flash.events.MouseEvent;
    import flash.net.FileReference;
    import flash.utils.ByteArray;
    import flash.net.URLRequest;
    import org.alivepdf.fonts.CoreFont;
    import org.alivepdf.fonts.FontFamily;
    import org.alivepdf.fonts.IFont;
    import org.alivepdf.layout.Orientation;
    import org.alivepdf.layout.Size;
    import org.alivepdf.layout.Unit;
    import org.alivepdf.pdf.PDF;
    import org.alivepdf.saving.Download;
    import org.alivepdf.saving.Method;
    import org.alivepdf.images.*;
    public class CreatePDF extends Sprite
        private var _pdfByteArray:ByteArray;
        public function CreatePDF():void
            // constructor code
        public function onCreatePDF():void
            var pdf:PDF = new PDF(Orientation.PORTRAIT,Unit.MM,Size.LETTER);
            var helvetica:IFont = new CoreFont(FontFamily.HELVETICA);
            var timesbold:IFont = new CoreFont(FontFamily.TIMES_BOLD);
            var loader:Loader=new Loader();
            addChild(loader);
            loader.load(new URLRequest("header_whiteBG.png"));
            pdf.addPage();
            pdf.setFont(timesbold, 24);
            pdf.addText("Memorial Healthcare System",55,12);
            pdf.addImage(loader,null,10,100,600,70,0,1,true,"PNG",100,"Normal",null);
            pdf.setFont(timesbold, 16);
            pdf.addText("This is my Pagre Title",40,20);
            pdf.addText("This is my Sub-Header",70,25);
            pdf.newLine(20);
            _pdfByteArray = pdf.save(Method.LOCAL,null,Download.ATTACHMENT);
            new FileReference().save(_pdfByteArray, "Test.pdf");
Any help will be most appreciated.

I am so sorry to ask again but I have been trying to this. I understand what you are trying to do but I am still getting this error:
C:\CreatePDF.as, Line 76    1067: Implicit coercion of a value of type flash.display:BitmapData to an unrelated type flash.display:DisplayObject.
I did tweak the code  you gave me a little and here it is:
package GUI
    import flash.display.*;
    import flash.events.MouseEvent;
    import flash.net.FileReference;
    import flash.utils.ByteArray;
    import flash.net.URLRequest;
    import flash.events.Event;
    import org.alivepdf.fonts.CoreFont;
    import org.alivepdf.fonts.FontFamily;
    import org.alivepdf.fonts.IFont;
    import org.alivepdf.layout.Orientation;
    import org.alivepdf.layout.Size;
    import org.alivepdf.layout.Unit;
    import org.alivepdf.pdf.PDF;
    import org.alivepdf.saving.Download;
    import org.alivepdf.saving.Method;
    import org.alivepdf.images.*;
    public class CreatePDF extends Sprite
        private var _pdfByteArray:ByteArray;
        public function CreatePDF():void
            // constructor code
        public function onCreatePDF():void
            var loader:Loader=new Loader();
            addChild(loader);
            loader.load(new URLRequest("header_whiteBG.png"));
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,f);
        function f(e:Event):void
            var pdf:PDF = new PDF(Orientation.PORTRAIT,Unit.MM,Size.LETTER);
            var helvetica:IFont = new CoreFont(FontFamily.HELVETICA);
            var timesbold:IFont = new CoreFont(FontFamily.TIMES_BOLD);
            pdf.addPage();
            pdf.setFont(timesbold, 24);
            pdf.addText("This is my Page Header Text",55,12);
******** pdf.addImage(Bitmap(e.target.loader).bitmapData,null,10,100,600,70,0,1,true,"PNG",100,"No rmal",null);******
            pdf.setFont(timesbold, 16);
            pdf.addText("This is my Page Title",40,20);
            pdf.addText("This is my Sub-Header",70,25);
            pdf.newLine(20);
            _pdfByteArray = pdf.save(Method.LOCAL,null,Download.ATTACHMENT);
            new FileReference().save(_pdfByteArray, "Test.pdf");
I have marked the line where I am getting the error *****. I was concerned with the variable "loader" on that line as it is being marked by Flash as a key word. I did try changing the var name but still got the same error.

Similar Messages

  • Flex 4 - Generate PDF - AlivePDF

    Hello all.
    I am in need of creating PDF documents from a flash project.  THe flash project needs to be using the latest flex 4. And i will be sing the <s:Application> tags.
    I grabbed an example from "Tour de Flex"  but it was built using <mx:Application>. The code for this example is here
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application  xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
         viewSourceURL="srcview/index.html" backgroundColor="0x000000" layout="absolute">
        <mx:Script>
            <![CDATA[
                import org.alivepdf.pages.Page;
                import org.alivepdf.pdf.PDF;
                import org.alivepdf.layout.Orientation;
                import org.alivepdf.layout.Size;
                import org.alivepdf.layout.Unit;
                import org.alivepdf.display.Display;
                import org.alivepdf.saving.Method;
                import org.alivepdf.fonts.FontFamily;
                import org.alivepdf.fonts.Style;
                import org.alivepdf.colors.RGBColor;
                import mx.utils.UIDUtil;
                protected var claimPDF:PDF;
                [Embed(source="assets/Insuricorp-Logo.jpg", mimeType="application/octet-stream" )]
                protected var jpgBytes:Class;
                protected function savePDF(e:MouseEvent):void
                    claimPDF = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);
                    claimPDF.setDisplayMode (Display.FULL_WIDTH);
                    claimPDF.addPage();
                    claimPDF.addImageStream(new jpgBytes() as ByteArray, 5, 5, 0, 0, 1);
                    claimPDF.setFont(FontFamily.ARIAL , Style.NORMAL, 12);
                    claimPDF.addText("Claimant Name: " + this.firstName.text + " " + lastName.text,10,40);
                    claimPDF.addText("Date: " + this.date.text,10,50);
                    claimPDF.addTextNote(48,45,100,2,"Claim Filed on: " + this.date.text + " today's date: " + new Date());
                    claimPDF.addText("Policy #: " + this.policyNum.text,10,60);
                    claimPDF.addText("Contact #: " + this.contact.text,10,70);
                    claimPDF.addText(this.claimNum.text,10,80);
                    claimPDF.addText("Claim Description:",10,90);
                    claimPDF.setXY(10,95);
                    claimPDF.addMultiCell(200,5,desc.text);
                    // HERE IS HOW TO SAVE FROM FLASH PLAYER 10 OR GREATER. THIS IS USED FOR THIS SAMPLE.
                    var bytes:ByteArray = claimPDF.save(Method.LOCAL);
                    var f:FileReference = new FileReference();
                    f.save(bytes,"tourdeflex-pdf-sample.pdf");
                    // HERE IS HOW TO SAVE FROM AN AIR APP
                    var fs:FileStream = new FileStream();
                    var file: File = File.desktopDirectory.resolvePath("tourdeflex-pdf-sample.pdf");
                    fs.open(file, FileMode.WRITE);
                    var pdfBytes:ByteArray = claimPDF.savePDF(Method.LOCAL);
                    fs.writeBytes(pdfBytes);
                    fs.close();
                     // HERE IS HOW TO SAVE FROM FLEX APP RUNNING FLASH PLAYER < 10
                     /* NOTE: To save the PDF from a Flex application if running Flash Player version < 10, you need to call a server-side
                              script as the 2nd parameter of the save call. More information about this can be found here:
                              http://alivepdf.bytearray.org/?p=17
                    claimPDF.save( ethod.REMOTE, "http://alivepdf.bytearray.org/wp-content/demos/create.php", "tourdeflex-pdf-sample.pdf");*/
                protected function submitClaimNum():void
                    claimNum.text='Claim # Assigned: '+ UIDUtil.createUID();//just generate a random id for sample purposes
                    this.savePDFBtn.visible=true;
            ]]>
        </mx:Script>
        <mx:Style>
            FormItem, Label, Button {
                color: #FFFFFF;
            TextInput, DateField {
                color: #000000;
        </mx:Style>   
        <mx:Label top="10" left="10" text="Input information and press 'File Claim' to get assigned claim #, then press Save to PDF." color="0xCCCCCC"/>   
         <mx:Label fontSize="18" text="Insurance Claim Form" left="10" top="30"/>
        <mx:HBox width="100%" height="100%" top="40" left="10" color="0x000000">
            <mx:Form id="form1" width="283" height="300">
                <mx:FormItem label="First Name:">
                    <mx:TextInput id="firstName"/>
                </mx:FormItem>
                <mx:FormItem label="Last Name:">
                    <mx:TextInput id="lastName"/>
                </mx:FormItem>
                <mx:FormItem label="Date:">
                    <mx:DateField id="date" />
                </mx:FormItem>
                <mx:FormItem label="Policy #:">
                    <mx:TextInput id="policyNum" />
                </mx:FormItem>
                <mx:FormItem label="Contact #:">
                    <mx:TextInput id="contact" maxChars="12"/>
                </mx:FormItem>
            </mx:Form>   
            <mx:Canvas top="10" left="10" width="300" height="100%">
                <mx:Label text="Description:" y="2"/>
                <mx:TextArea id="desc" y="18" height="133" width="205"/>   
            </mx:Canvas>
        </mx:HBox>
        <mx:HBox top="205" left="185">
            <mx:Button label="File Claim" click="submitClaimNum()"/>
            <mx:Button horizontalCenter="0" click="savePDF(event)" label="Save to PDF" id="savePDFBtn" visible="false"/>
        </mx:HBox>
        <mx:Label id="claimNum" top="238" left="83"/>
    </mx:Application>
    SO i tried changing it to <s:Application>  but i get a load of errors saying stuff isnt supported etc etc.
    My main question is -  Does flex 4 and <s:Application> support AlivePDF or is there another way to create PDF documents?
    My code for the application where i have tried to change it to the latest flex version is as follows
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
            import org.alivepdf.pages.Page;
            import org.alivepdf.pdf.PDF;
            import org.alivepdf.layout.Orientation;
            import org.alivepdf.layout.Size;
            import org.alivepdf.layout.Unit;
            import org.alivepdf.display.Display;
            import org.alivepdf.saving.Method;
            import org.alivepdf.fonts.FontFamily;
            import org.alivepdf.fonts.Style;
            import org.alivepdf.colors.RGBColor;
            import mx.utils.UIDUtil;
            protected var claimPDF:PDF;
            [Embed(source="assets/Insuricorp-Logo.jpg", mimeType="application/octet-stream" )]
            protected var jpgBytes:Class;
            protected function savePDF(e:MouseEvent):void
            claimPDF = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);
            claimPDF.setDisplayMode (Display.FULL_WIDTH);
            claimPDF.addPage();
            claimPDF.addImageStream(new jpgBytes() as ByteArray, 5, 5, 0, 0, 1);
            claimPDF.setFont(FontFamily.ARIAL , Style.NORMAL, 12);
            claimPDF.addText("Claimant Name: " + this.firstName.text + " " + lastName.text,10,40);
            claimPDF.addText("Date: " + this.date.text,10,50);
            claimPDF.addTextNote(48,45,100,2,"Claim Filed on: " + this.date.text + " today's date: " + new Date());
            claimPDF.addText("Policy #: " + this.policyNum.text,10,60);
            claimPDF.addText("Contact #: " + this.contact.text,10,70);
            claimPDF.addText(this.claimNum.text,10,80);
            claimPDF.addText("Claim Description:",10,90);
            claimPDF.setXY(10,95);
            claimPDF.addMultiCell(200,5,desc.text);
            // HERE IS HOW TO SAVE FROM FLASH PLAYER 10 OR GREATER. THIS IS USED FOR THIS SAMPLE.
            var bytes:ByteArray = claimPDF.save(Method.LOCAL);
            var f:FileReference = new FileReference();
            f.save(bytes,"tourdeflex-pdf-sample.pdf");
            // HERE IS HOW TO SAVE FROM AN AIR APP
            var fs:FileStream = new FileStream();
            var file: File = File.desktopDirectory.resolvePath("tourdeflex-pdf-sample.pdf");
            fs.open(file, FileMode.WRITE);
            var pdfBytes:ByteArray = claimPDF.savePDF(Method.LOCAL);
            fs.writeBytes(pdfBytes);
            fs.close();
            // HERE IS HOW TO SAVE FROM FLEX APP RUNNING FLASH PLAYER < 10
            /* NOTE: To save the PDF from a Flex application if running Flash Player version < 10, you need to call a server-side
            script as the 2nd parameter of the save call. More information about this can be found here:
            http://alivepdf.bytearray.org/?p=17
            claimPDF.save( ethod.REMOTE, "http://alivepdf.bytearray.org/wp-content/demos/create.php", "tourdeflex-pdf-sample.pdf");*/
            protected function submitClaimNum():void
            claimNum.text='Claim # Assigned: '+ UIDUtil.createUID();//just generate a random id for sample purposes
            this.savePDFBtn.visible=true;
            ]]>
        </fx:Script>
        <mx:Label top="10" left="10" text="Input information and press 'File Claim' to get assigned claim #, then press Save to PDF." color="0xCCCCCC"/>   
        <mx:Label fontSize="18" text="Insurance Claim Form" left="10" top="30"/>
        <mx:HBox width="100%" height="100%" top="40" left="10" color="0x000000">
            <mx:Form id="form1" width="283" height="300">
                <mx:FormItem label="First Name:">
                    <mx:TextInput id="firstName"/>
                </mx:FormItem>
                <mx:FormItem label="Last Name:">
                    <mx:TextInput id="lastName"/>
                </mx:FormItem>
                <mx:FormItem label="Date:">
                    <mx:DateField id="date" />
                </mx:FormItem>
                <mx:FormItem label="Policy #:">
                    <mx:TextInput id="policyNum" />
                </mx:FormItem>
                <mx:FormItem label="Contact #:">
                    <mx:TextInput id="contact" maxChars="12"/>
                </mx:FormItem>
            </mx:Form>   
            <mx:Canvas top="10" left="10" width="300" height="100%">
                <mx:Label text="Description:" y="2"/>
                <mx:TextArea id="desc" y="18" height="133" width="205"/>   
            </mx:Canvas>
        </mx:HBox>
        <mx:HBox top="205" left="185">
            <mx:Button label="File Claim" click="submitClaimNum()"/>
            <mx:Button horizontalCenter="0" click="savePDF(event)" label="Save to PDF" id="savePDFBtn" visible="false"/>
        </mx:HBox>
        <mx:Label id="claimNum" top="238" left="83"/>
    </s:Application>
    If anyone can help that would be great

    Flex 4 supports alive pdf generation.
    Follwing is the sample code of generating pdf.
    var newPDF:PDF =
    new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);newPDF.setDisplayMode (Display.FULL_WIDTH);
    newPDF.addPage();
    newPDF.setFont(FontFamily.ARIAL , Style.BOLD, 18);
    newPDF.addText(
    "TITLE" ,100,10);newPDF.setFont(FontFamily.ARIAL , Style.NORMAL, 16);
    newPDF.setXY(10,95);
    newPDF.addImage(orderDG,50,20);
    newPDF.addText(
    "TEST 1 " ,50,120);newPDF.addText(
    "TEST 2 ",150,120); 
    var fileREf:FileStream = new FileStream();var file:File = File.applicationStorageDirectory.resolvePath('Test.pdf');
    var stream:FileStream = new FileStream()
    stream.open(file,FileMode.WRITE);
    stream.writeBytes(newPDF.save(Method.LOCAL));
    stream.close();

  • AlivePDF seems to flip image alond axis?

    Hi,
    In my flash file, I allow the user to rotate an image. After the image is rotated, the user can save the edited image as a PDF. I'm using AlivePDF for saves.
    Here is the problem: If the user rotates in the X or Y, the pdf image looks flipped along the respective axis(for example, if I rotate in the X, the image looks like it rotated properly, but the perspective is reversed). If the rotation is in the Z, there is no issue. The event listeners are attached to slider components.
    Here is an image to clarify-
    My question: How can I get the image to render properly in the PDF?
    Rotate Code:
    //rotate logo around the X axis
    logoRotX.text = "Rotate X: 0"
    logoRotateX.value = 0;
    logoRotateX.addEventListener(SliderEvent.CHANGE, logoRotateXPos);
    function logoRotateXPos (event:SliderEvent): void
        logoRotX.text = "Rotate X: " + event.target.value;
        container.rotationX = event.target.value;
    //rotate logo around the Y axis
    logoRotY.text = "Rotate Y: 0"
    logoRotateY.value = 0;
    logoRotateY.addEventListener(SliderEvent.CHANGE, logoRotateYPos);
    function logoRotateYPos (event:SliderEvent): void
        logoRotY.text = "Rotate Y: " + event.target.value;
        container.rotationY = event.target.value;
    //rotate logo around the Z axis
    logoRotateZ.value = 0;
    logoRotateZ.addEventListener(SliderEvent.CHANGE, logoRotateZPos);
    function logoRotateZPos (event:SliderEvent): void
        logoRotZ.text = "Rotate Z: " + event.target.value;
        container.rotationZ = event.target.value;
    Save PDF code:
    createPdfBTN.addEventListener(MouseEvent.CLICK, makePDF);
    function makePDF(evt: MouseEvent)
    var myPDF : PDF = new PDF (Orientation.PORTRAIT,Unit.INCHES, Size.LETTER);
    myPDF.setDisplayMode(Display.FULL_PAGE);
    myPDF.addPage();
    // add a background image
    var PDFsampleData: BitmapData = new BitmapData(BGContain.width, BGContain.height);
        PDFsampleData.draw(BGContain);
    var PDFjpg:JPGEncoder = new JPGEncoder(100);
    var PDFba:ByteArray = PDFjpg.encode(PDFsampleData);
    var timesbold:IFont = new CoreFont(FontFamily.TIMES_BOLD);
    myPDF.addImage(BGContain);
    myPDF.setFont(timesbold, 12);
    myPDF.addText("Disclaimer: This image is for visualization purposes only and is not a proof.",.5,10);
    // save PDF
    var fileReference:FileReference = new FileReference();
    var pdfByteArray = myPDF.save(Method.LOCAL);
    fileReference.save(pdfByteArray, 'Your Sample.PDF');

    I fixed this by using ScaleX and ScaleY instead of rotateX and rotateY. Now, the PDF renders fine.

  • Scrollbar appearing while creating pdf using AlivePDF

    Hi,
    I am facing a problem while creating pdf using AlivePDF.
    I have a VBox on which I am adding multiple pages. If the content overflows it shows scrollbar. All this is working fine.
    [PHP]
    <mx:VBox x="0" y="80" width="705" height="560" id="content"></mx:VBox>
    [/PHP]
    When I create the pdf using the following code it shows scrollbar in  generated pdf (attached screenshot) while I want all the content without  scrollbar
    [PHP]
    var pg:DisplayObject;
    pg = content.getChildAt(i);
    var pdf:PDF;
    pdf = new PDF (Orientation.PORTRAIT, Unit.POINT, Size.LETTER);
    pdf.setDisplayMode(Display.FULL_WIDTH);
    pdf.addPage();
    pdf.addImage(pg, new Resize(Mode.FIT_TO_PAGE, Position.CENTERED ),0, 0, 0, 0, 0, 1,true,'PNG',100);
    [/PHP]
    Please suggest what changes should I make to fix this.

    If the report didn't change, then perhaps the data did. Check
    to make sure the data being supplied to the report is as expected.
    I have run into mysterious errors where an expected value was of
    the wrong type or a required value was now blank. It is also
    possible to have existing logical errors in an iif() or other
    dynamic evaluation expression that was not previously examined;
    until now. So, is there any unexpected or exceptional data the
    report cannot handle?

  • Need help with AlivePDF

    I am using AlivePDF  for a requirement in my AIR project.Here is my scenerio
    I am using Tab navigator with one viewstack having Chart and another having Datagrid
    I have a number of panels with graphs and charts in the Datagrid. User sees many panels at a time.
    1)How can I present these Panels(with Charts)  to different pages of PDF?
    2)How can I write to pdf  both chart and datagrid  in a tab navigator, and if the creation policy is such that it is loaded only when user selects?
    Do relpy me as soon as possible. Your help will be highly appreciated
    Also I have problem in Using addImage();
    pdf.addImage(dg1, RESIZE,15,20,100,200,0,1,
    true,ImageFormat.PNG,100,BlendMode.NORMAL);
    what parameter we have to use for resize here. I am using latest version  .1.5 beta.  I a getting error  for resize

    NAVARRO360 wrote: ...  there is no simple fix?  ...
    Eureka! You now understand the situation.
    Even the old standard for Mac OS X drivers for non-compatible cams, macam, says that it has no driver for ASUS (20") monitor camera.
    The macam status shows:
    not working (no documentation)
    With no working driver for the 20" ASUS, it is not surprising that there is none for the 27" either.  There may be good reason that ASUS won't (or can't) offer either the technical documentation or a Mac driver for their monitor's inbuilt webcam.  However, they apparently do not publish that information. 
    If ASUS Technical Support cannot provide the driver you need for OS X, the ASUS will continue to be a ridonculous (sic) monitor whose webcam will not work with your OS X Mac.  The only other simple fix I can think of is to use the ASUS with a different PC that is compatible with this monitor and its inbuilt webcam.  What you do is certainly your choice. 
    Message was edited by: EZ Jim
    Mac OSX 10.7.3

  • Adding a movieclip to AlivePDF

    Hi everyone,
    I am wrapping my head around AlivePDF. I can't seem to find an aswer to this question. Can I add a movieclip as the data to include inside the page? I have it so that the PDF generates text from specific text fields, but I want it to show "mainContent_mc" to the page. I am building this as an AIR app (apperantly you can't do this from an EXE file published from Flash).
    thank you in advance,
    Rafael.

    OK,
    If anyone is reading this... I figured out how to add the movieclip to the page I created (using "addImage"). Now, when I click on the button that creates the movieclip, the PDF gets created to the user's desktop, BUT, it deletes everything inside my stage. My stage goes blank!!! Why would this happen? Any ideas?
    thank you,
    Rafael.

  • AlivePDF - MXML vs AS

    Hi,
    I'm using AlivePDF, when I add an object created with AS to the pdf file it doesn't appear in the pdf file. But objects created with MXML do appear in the pdf. I wonder if this is normal situation or am I doing something wrong?
    Of course object created with AS is added to stage and I can see it on stage, but can't see it in pdf.

    Sure
    This works:
    <mx:TextArea id="abc" text="abc" width="200" height="200"/>
    printPDF.addPage();
    printPDF.addImage(abc);
    And this doesn't work:
    var abc:TextArea = new TextArea;
    abc.text = "abc";
    abc.width = 200;
    abc.height = 200;
    addChild(abc);
    printPDF.addPage();
    printPDF.addImage(abc);
    There is one more thing I just found out - when I run the second (pure AS) code in debug mode it works fine.
    I think that it's becouse code executes slowly. And when code executes fast (without debug mode) the 'addImage' statement adds TextArea without it's properties like 'text'. But on the other hand alive pdf must add objects, which are displayed - so the code 'addChild(abc)' must be executed or else I got error that 'abc' is not on stage or something similar. And I don't get this error.
    I completly don't understand this
    Any ideas, please?

  • How to load and show PDF on stage in Flash using AlivePDF or PurePDF external libraries?

    Hello,
    I searched a lot on internet but didn't find a proper way to load and open/show PDF on stage in Flash. Following are my understandings about this topic.
    I know Flash does not have the built-in functionality to load and show pdf document on stage.
    I know you can do this in AIR application using HTMLLoader class but it required adove reader to be installed on your machine.
    I have used AlivePDF/PurePDF and I know how to export/generate a PDF File using these libraries but I don't know how to use them to load and show PDF document on stage in Flash. According to my research, I think these libraries can accomplish my task but how, I don't know. That's because I am here for your help.
    People suggest to first convert pdf into an image or swf file and then import it into Flash but I don't want this solution because my clients will be importing/uplading PDF file into my software.
    Some people suggest to "Convert PDF renderer code written in C/C++ using Alchemy to flash library" and then use that library to my project. I don't have any idea how to do this. If anyone can help me to achieve required functionality this way, please guide me.
    Now you know about my understandings, so you can guide me in better way. Let me give you an example what kind of functionality I want. Please visit: https://www.pdffiller.com. Upload a pdf file there and you will see that it shows that pdf to user (At the moment, I want this functionality) and pdf annotation i.e. write text on pdf and other functionalities.
    NOTE: I am not a Flex and AIR developer. I am a Flash (Actionscript 3.0) Developer. So please first help according to flash. If you want to offer the solution according to Flex and AIR, you are most welcome.
    I specially want "ADOBE EXPERTS - Adobe Flash developer from Adobe" to comment on this and help me out. It's about 4th day I am without a solution. I am afraid, I'll loose my client if I'll not have a solution in next couple of days.
    Thanks,
    momersaleem
    eLearning Specialist

    Just to throw in a $0.02, I looked at those libraries myself quite a while ago and all they had the ability to do was give you information and assets from the PDF. At that point you literally had to read each page in the PDF (whatever the library could extract), use the information it extracted (position, type size, images, etc) and create a layout engine that could "reconstruct" the page piece by piece.
    I hope it's better these days but that's what I took from those libraries quite a while ago and it may still be true. That would explain "Convert PDF renderer code written in c/c++ using Alchemy to flash library". Someone may already have written a quality layout engine. Otherwise there was no "load pdf, run this ShowPDF() function to add to display list" functionality at all.

  • AlivePDF, PurePDF and actionscript 3.0

    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.

    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);

  • AlivePDF HTTPS

    I trying to understand an issue I am having with a Flex
    builder 2 application and AlivePDF over https. I first programmed
    the application on a non-ssl connection and everything works just
    great. I then moved to migrate the application to a https
    environment and ran into some minor crossdomain.xml security issue
    but was able to resolve all but one problem: I am using AlivePDF to
    create a dynamic sign which creates a bytestream and passes it
    along to a php script that send it back as a pdf file. See attached
    script. I have yet to be able to tie this to flex security issue
    but do not want to rule anything out until I find a resolution. I
    need the expertise of this forum to help me out because at best I
    am a moderately skilled flex programmer and hope I can come to a
    speedy resolution. Thanks for any assistance.

    Hi,
    Thank you for posting.
    In order to resolve the isuse, please add
    https://printables.hpconnected.com
    to the trusted sites in Internet explorer.
    To do so, please click on the Gear icon in the top right hand cornere of the internet explorer and click on Internet Options. In eth internet Options window, please click on Security and then click on Trusted sites and click on sites and add
    https://printables.hpconnected.com and click on Ok. then delete the temporary internet files and cookies and thy to access.
    Say "Thanks" by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"
    (Although I am employed by HP, I am speaking for myself and not for HP)

  • Why AlivePDF generate double header?

    I'm trying to generate a simple table with alivePDF. This is my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                                            xmlns:mh="mh.components.*"
                                            layout="absolute" width="500" height="500">
              <mx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  import org.alivepdf.colors.RGBColor;
                                  import org.alivepdf.display.Display;
                                  import org.alivepdf.drawing.Caps;
                                  import org.alivepdf.fonts.FontFamily;
                                  import org.alivepdf.fonts.Style;
                                  import org.alivepdf.grid.Grid;
                                  import org.alivepdf.images.ImageFormat;
                                  import org.alivepdf.layout.Orientation;
                                  import org.alivepdf.layout.Resize;
                                  import org.alivepdf.layout.Size;
                                  import org.alivepdf.layout.Unit;
                                  import org.alivepdf.pages.Page;
                                  import org.alivepdf.pdf.PDF;
                                  import org.alivepdf.saving.Method;
                                  import org.alivepdf.visibility.Visibility;
                                  import org.alivepdf.grid.*;
                                  import mx.utils.ObjectUtil;
                                  private var myPDF:PDF;
    protected function savePDF(e:MouseEvent):void
                                            var myPDF:PDF = new PDF ( Orientation.PORTRAIT, Unit.MM);
                                            myPDF.setDisplayMode(Display.FULL_PAGE);
                                            myPDF.addPage();
                                            var dp:ArrayCollection = new ArrayCollection();
                                            dp.addItem( { firstName : "Bob", lastName : "Groove", city : "Paris" } );
                                            dp.addItem( { firstName : "Bob", lastName : "Wise", city : "Paris" } );
                                            dp.addItem( { firstName : "Bob", lastName : "Wise", city : "Paris" } );
                                            dp.addItem( { firstName : "Bob", lastName : "Wise", city : "Paris" } );
                                            myPDF.textStyle ( new RGBColor ( 0x0EEFF0 ) );
                                            trace(ObjectUtil.toString(dp));
                                            var grid:Grid = new Grid ( dp.toArray(), 200, 100, new RGBColor (0x000000),null,false,null,null,0,12,6,"0j");
                                            myPDF.addGrid( grid, 5, 5);
                                            myPDF.save( Method.REMOTE, "coldfusion/pdf.cfm", "inline", "test.pdf" );
                        ]]>
              </mx:Script>
              <mx:VBox width="100%" height="100%">
                        <mx:HBox width="100%" backgroundColor="#FFFFFF">
                                  <mx:Spacer width="100%"/>
                                  <mx:Button horizontalCenter="0" label="SavePDF" height="22"  click="savePDF(event)"  id="savePDFBtn" toolTip="SAVE TO PDF"/>
                        </mx:HBox>
              </mx:VBox>
    </mx:Application>
    The problem is that this generate a double header and I don't know why. You can see a live example here: http://docs.google.com/viewer?url=http://prestitiinpdap.biz/pdf/myPDF.pdf
    Could you help me solve this error?
    Thanks

    Many thanks, but the support seems discontinued also in the forum.
    I got an answers on http://stackoverflow.com/questions/14799768/why-alivepdf-generate-double-table-header

  • AlivePDF setup

    Does anyone here have experience with AlivePDF?  Has anyone gotten it to work?  It seems like the default answer for getting PDF generation in Flex is to use AlivePDF but their web site mostly has examples using AIR.
    I am using AlivePDF 0.1.4.9. in Flex (tried SDK 3.0 and 3.3) when I generate the pdf, a new browser window pops up and…nothing happens. I
    tried it with create.php, create.java, and looked into saving it with Flash Player 10 (but couldn't find any real documentation on how to make that work). I
    just get a blank new browser window. No error message, no anything.
    I added the swc file to my library path, used the tutorial sample code…and still nothing happens:
    myPDF = new PDF();
    var page:Page = new Page ( Orientation.PORTRAIT, Unit.MM, Size.A4 );
    myPDF.addPage(page);
    myPDF.lineStyle(new RGBColor(0×990000), 1,1,1);
    myPDF.drawCircle(20,20,20);
    var path:String = getBaseURL() + "/terracotta/create.php";
    myPDF.save(Method.REMOTE, path, Download.INLINE, "viewChart.pdf");

    Actually, I'm a Java/Flex guy myself
    The only reason I mentioned the php is because it seemed to be the default "out of the box" approach for AlivePDF.  I also tried their create.java method which gave me the following error:
    java.lang.IndexOutOfBoundsException: The supplied offset + length did not fit into the supplied byte[] (offset + length = 1018 + 1018 = 2036 vs byte[].length = 1018)
    In case you don't have he create.java, here are the relevant methods:
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    doGet(req, resp);
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    int i = 0;
    int k = 0;
    int maxLength = req.getContentLength();
    byte[] bytes = new byte[maxLength];
    String method = req.getParameter("method");
    String name = req.getParameter("name");
    ServletInputStream si = req.getInputStream();
    while (true) {
    k = si.read(bytes, i, maxLength);
    i += k;
    if (k == -1){
    break;
    if (bytes != null) {
    ServletOutputStream stream = resp.getOutputStream();
    resp.setContentType("application/pdf");
    resp.setContentLength(bytes.length);
    // resp.setHeader("Content-Disposition",method + ";filename=" + name);
    stream.write(bytes);
    stream.flush();
    stream.close();
    } else {
    resp.setContentType("text");
    resp.getWriter().write("bytes is null");

  • Using AlivePDF with AS3

    Hi, I'm somewhat new to AS3 and programming. I'm trying to use the AlivePDF library to export text from a text editor created in AS3 into a PDF. Can anyone link me to documentation or a tutorial that can help teach me how to integrate it into a normal AS3 file? I have no idea how to use the library and the only documentation I've seen for it is how to use it in Flex/Air, which is not what I'm looking for.
    Thanks!

    Last year, I did a project that used AlivePDF. I found that there wasn't as much tutorial content on the Web as I would have liked. For folks that are new(er) to AS3 - it is lacking enough in Flash  tutorials to make it "kinda out of reach" without struggling. Even for  myself, I wished there were more simple, but extensive, examples to cull  from.
    Like you, I kept getting search hits showing me a small handful of Flex apps that used it, but I was able to sift through a few things, including the website that provides the API for us. So this is most likely not going to get you what you want - it was a little bit of a slow start for me, and I just had to "grow" from the small examples I found on the main website, and look at the API documentation...and then put in the time to try my own simple tests.So, I can really only suggest that you start small, understand the basics of AlivePDF, and work from what you have success with.
    You've probably been here, but most of what I learned came from the various pages of th main AlivePDF website:
    http://alivepdf.bytearray.org/
    The link to the API documentation:
    http://alivepdf.bytearray.org/alivepdf-asdoc/
    there's a Google Wiki, with other API notes:
    http://code.google.com/p/alivepdf/wiki/APINotes

  • Getting alivePDF

    I have downloaded it and I dont see SWF file. Do I need to compile it myself? How do I load it into FB 4.5?
    Thanks

    Hi,
    I'm not familiar with AlivePDF specifically, but it looks like the ZIP files provided on their download page are Flash Builder projects of a sort. You can expand the ZIP file and then import the project through File | Import... | Existing Projects into Workspace
    The project organization is a little different from the current project format, though; you should probably direct questions to the AlivePDF forum at http://alivepdf.bytearray.org/?page_id=12 .
    HTH,
    -- Tom Kraikit
    Flex SDK engineer

  • AlivePDF with Flex+tomcat+BlazeDS

    If you used alivePDF in the same comfiguration, please help
    me!
    There is create.java file that comes with AlivePDF that I
    think I have to use in my case. But where do I place it so I can
    call it from Flex app as a parameter for save() method?

    If you used alivePDF in the same comfiguration, please help
    me!
    There is create.java file that comes with AlivePDF that I
    think I have to use in my case. But where do I place it so I can
    call it from Flex app as a parameter for save() method?

Maybe you are looking for

  • Photo management solutions?

    I have four Iphone 5 photo folders... 1) Camera Roll 2) Iphoto Sync 3) Videos amd 4) Parked (I created). Iphone will only allow me to delete the "parked" but I also want to delete all but the Camera Roll. Any suggestions? 3rd party app or program?

  • Some Nodes missing in CCMS Exchange Infrastructure "System Errors"

    Hi All, I have configured the ccms for XI System PI 7.0.But there are some nodes that are missing under system errors in XI node of CCMS Nodes present under system errors in XI: outbinding mapping Nodes that are missing under system errors in XI: XIc

  • SAX driver property

    Hi All, I am using apache xerces SAX driver in my java application. However, when I start the program I am having to specify the driver property like below java -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser MySAXAppI believe that it is pos

  • Upgrade to paid account in Sri Lanka

    Hi I'm from Sri Lanka and I cannot uggrade to a paid account as the country is not shown on the list. I need to save a form I created as a PDF.. Do I have any other way I could do it ?

  • I am finding all the Apple TV apps are gone

    I am finding all the Apple TV apps are disappeared except settings and computer. I have setup automatic software upgrade and I an am not sure if one of the auto upgrades went wrong. I have tried to restart and reset, but no luck. Any help is apprecia