Select to view content in your preferred language

AlivePDF and Flex 2.x

1441
10
02-04-2011 07:54 AM
DouglasGuess
Regular Contributor
I had a widget in my old FlexViewer 1.x app that would create a pdf utilzing the AlivePDF 1.4.9 library.  I'm trying to replicate this tool in my new FlexViewer 2.x app and when the pdf is created, I keep getting the attached error.

The pdf will generate the text info but no map image is being displayed.  Here is the line of code calling the pdf...

myPDF.save(Method.REMOTE, "<my server>/default.aspx", Download.INLINE, "mapPDF.pdf");

Does AlivePDF not work with the Flex 4 SDK and SFV 2.x???
Tags (2)
0 Kudos
10 Replies
ReneRubalcava
Esri Frequent Contributor
I know it still works with the current Flex API as myself and others still use it, but I don't save remotely, so I'm not sure if that might be the issue.

I let users save locally, so mine just looks like this.
var bytes:ByteArray = _pdf.save(Method.LOCAL);
fileReference.save(bytes, "map.pdf");
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Doug,

   In FlexViewer 2.2 there is really no need for the remote server method of saving as FV2.2 requires Flash Player 10 or above which gives you the ability to save files to the client machine. Try this:

    const fileReference:FileReference = new FileReference();
    fileReference.addEventListener(Event.COMPLETE, removeCur);
    fileReference.addEventListener(Event.CANCEL, removeCur);
    fileReference.addEventListener(IOErrorEvent.IO_ERROR, removeCur);
    fileReference.addEventListener(SecurityErrorEvent.SECURITY_ERROR, removeCur);
    fileReference.save(myPDF.save(Method.LOCAL,"",Download.INLINE,"myPDF.pdf"),"map.pdf");
0 Kudos
DouglasGuess
Regular Contributor
I tried that and the resulting pdf output is attached....text info is displayed but no map image.  I get the error message when I open the pdf.  I'm using Adobe 9.  I've also attached my createPDF widget if that helps.

Thanks for the help!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Doug,

   AlivePdf has issues with transparency in png files so you need to change to JPG like this:

myPDF.addImage(map,4,32,w-8,(w-20)/ratio,ImageFormat.JPG,100,Blend.NORMAL,null);
0 Kudos
MehulChoksey
Esri Contributor
Might want to check out this pdf generation library too..
http://code.google.com/p/purepdf/
0 Kudos
DouglasGuess
Regular Contributor
Changed to jpg and still no luck.  This same code worked in my flex 1.x app???  Has anyone successfully implemented the purePDF library?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Doug,

   I will try to dig into your widget code a little more... I have my print widget working just fine in FlexViewer 2.2 with AlivePDF 0.1.5 RC.
0 Kudos
DouglasGuess
Regular Contributor
I downloaded AlivePDF 0.1.5 RC, there were some changes to font declarations; however, I'm still receiving the error message.  Robert, you said that you have your widget working fine, could I see how you are setting up your pdf page and how you add the map image?

Thanks again.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Doug,

   Sure, Of course I am doing stuff in the code specific to my sites needs, but here it is:
0 Kudos