Select to view content in your preferred language

Printing Problem with AlivePDF

3236
22
06-09-2010 12:43 PM
BradOleson
Emerging Contributor
The continuing printing saga:

I've installed a sample print utility from this thread:
http://forums.esri.com/Thread.asp?c=158&f=2421&t=299883&mc=11#936860

The solution calls for 2 parts - installing a .Net piece on the server in IIS and then adding the Flex components to the Flex project.  Everything seems fine on the Flex side, but when I run the create PDF code from the Flex app there is an error in the .Net piece. 

When run on a remote machine the attached Error1 page appears.  When I check the app URL on the server side, I get a little more detail, but still errors out, as shown in the Error2 attachment.

I sent the author an e-mail directly, but thought I'd post here as well to see if anyone knew right off if there was a fix.  I've already checked .Net versions and 3.5 is the installed / required version.  I've also created a separate app pool in IIS in case that was an issue (from reading online ASP .Net forums / blogs).

Anyone have any ideas?

Brad
0 Kudos
22 Replies
RobertScheitlin__GISP
MVP Emeritus
Brad,

   That dot Net portion can be avoid completely if you force your clients to use Flash Player 10. If you set your flex projects html wrapper to use flash player 10.0.22 or higher than you can use code like this in your print widget

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
by Anonymous User
Not applicable
Original User: jtrappet2010

Do you need to be using the Flex 4 SDK to use FileReference.save?  In the 3.5 SDK help it shows the FileReference object as having a save method but when I try to use it I get an error:
1061: Call to a possibly undefined method save through a reference with static type flash.net:FileReference
0 Kudos
DasaPaddock
Esri Regular Contributor
No, you just need to require Flash Player 10. In the Compiler section of your project's properties, change "Require Flash Player version" to 10 0 0.
0 Kudos
by Anonymous User
Not applicable
Original User: brad_san

In my case I incorrectly installed the .Net piece...missed copying a file into the proper directory.  This was pointed out by a colleague who looked at it for 5 minutes yesterday.  Once that structure was repaired, things work fine!

I will keep things in mind for being able to do it another way, though, Robert.  Thanks!

Brad
0 Kudos
JacksonTrappett
Frequent Contributor
Thanks Dasa, that was an easy fix!
0 Kudos
by Anonymous User
Not applicable
Original User: jkalov

Brad,

   That dot Net portion can be avoid completely if you force your clients to use Flash Player 10. If you set your flex projects html wrapper to use flash player 10.0.22 or higher than you can use code like this in your print widget

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


Robert,

What is the "removeCur" in this code?  I am trying to use your code with a similar alivepdf widget and flexbuilder just sees "removeCur" as an undefined property.

Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Joshua,

   The RemoveCur is just a simple function that I have that will remove the busy cursor that I set when the pdf export begins. You can delete all those event listeners if you want to.
0 Kudos
by Anonymous User
Not applicable
Original User: jkalov

Joshua,

   The RemoveCur is just a simple function that I have that will remove the busy cursor that I set when the pdf export begins. You can delete all those event listeners if you want to.


Thanks.  I had it working before without them, but I wasn't sure if those lines added something.  What I'm really trying to get to is have the user be able to either save the pdf or choose to print directly.  (Basically what the "Print Map" widget is like on your Flexviewer 2.0 application (although mine is still 1.3).
0 Kudos
shafitrumboo
Occasional Contributor
I tried to implement as suggested by you but
var 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");

it result an error:
Error Message:
"Certain actions, such as those that display a pop-up window, may only be invoked upon user interaction, for example by a mouse click or button press."
0 Kudos