Anusha
Anusha

Reputation: 67

Generating PDF file from Flex/Flash developer

There are various links available on using AlivePDF to generate pdf. But these codes work only for showing text and fail when we try to show picture. Over that even format of function AddImage and AddImageStream is not matching with current format coming from Library org.alivepdf.*

I am not able to locate any recent question answered with similar query even at adobe.com forums.

In an attempt to make it work in declaration section I added image:

<fx:Declarations>
    <s:Image id="imgLogoLeft" source="@Embed(source='assets/logoleft.png')" backgroundColor="black"
             backgroundAlpha="1"
             width="30" height="30"/>
</fx:Declarations>

and then used in code as

pdf.addImage(imgLogoLeft,null,10,10,50,50);

with no help.

Use of addImageStream with various permutation and combinations do not work for me:

  pdf.addImageStream(new pngBytes() as ByteArray);

In this error is Alpha channel not supported for now.

Now I am wondering if any one is using AlivePDF for generating pdf or it's support for image is stopped? Is there any other library that can help me creating a pdf with images and text in more than one languages. I am still looking for solution. In can I get a solution from other place and from my trial and error will update this link. Else please if you know some one who is expert of flex and could know the solution to it, please ask her/him to share the solution.

Or alternatively can be save a boundrycontainer as picture?

Upvotes: 0

Views: 238

Answers (1)

Anusha
Anusha

Reputation: 67

Finally able to find the source of error.

1) My PNG file had transparent background and AlivePDF can not handle transparent backgrounds. 2) addImage can not handle image object from declaration area. Once I moved the images in invisible BorderContainer (so that they do not show in my page) I was able to embed them in pdf. But the quality was very poor to went with second option. 3) Lines can not be created in PDF using MoveTo lineTo method and ColorRGB takes single number and harder to handle, so I used other two methods, they work fine.

If any of future visitor needs any more information please feel free to comment. Being very infrequent visitor, I may not respond very promptly but will respond.

Upvotes: 3

Related Questions