Select to view content in your preferred language

Printing Problem with AlivePDF

2990
22
06-09-2010 12:43 PM
BradOleson
New 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
by Anonymous User
Not applicable
Original User: rscheitlin

Shafi,

   Just like the message is telling you you have to call this code directly from a mouse click like a button in a widget or a context menu. It can not be called from any other portion of code that call on another function before it opens the file save dialog.
0 Kudos
AimeiChen
Occasional Contributor
Shafi,

   Just like the message is telling you you have to call this code directly from a mouse click like a button in a widget or a context menu. It can not be called from any other portion of code that call on another function before it opens the file save dialog.


Hi, Robert
I added button click to load the printPDF function, but I have to click the button twice to open the save as window. Is something wrong with that?
Thanks,
Amy

private function PrintPDF():void
   {
    generatePDF();
    var fileReference:FileReference = new FileReference();
    fileReference.save(myPDF.save(Method.LOCAL,"",Download.INLINE,"myPDF.pdf"),"map.pdf");
   
   }
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Amy,

   The generate pdf function is taking the focus which forces you to have to click the button again to give the focus to the save method. You need to have a button for generate pdf and then then have the user click a button that only has the file reference code.
0 Kudos
AimeiChen
Occasional Contributor
Amy,

   The generate pdf function is taking the focus which forces you to have to click the button again to give the focus to the save method. You need to have a button for generate pdf and then then have the user click a button that only has the file reference code.


Got it, thank you so much.
0 Kudos
by Anonymous User
Not applicable
Original User: FrankTT

Hi,
I've been reading the latest threads regarding the PDF Prinitng widget, along with the latest Flex API. I've also implemented a PDF widget which utilizes Robert's code. Once the widget displays and I click "print pdf" I get the following errors:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.alivepdf.fonts::AFMParser/readAFM()[/Users/adobe/Desktop/AlivePDF/src/org/alivepdf/fonts/AFMParser.as:92]
at org.alivepdf.fonts::AFMParser/makeFont()[/Users/adobe/Desktop/AlivePDF/src/org/alivepdf/fonts/AFMParser.as:252]
at org.alivepdf.fonts::AFMParser()[/Users/adobe/Desktop/AlivePDF/src/org/alivepdf/fonts/AFMParser.as:53]
at org.alivepdf.fonts::EmbeddedFont()[/Users/adobe/Desktop/AlivePDF/src/org/alivepdf/fonts/EmbeddedFont.as:39]

I am using the latest AlivePDF.swc library, but I can't seem to troubleshoot the error. Looks like my application can't access the font file. Can you guys lead down the right track on this one.

Thanx
Frank
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Frank,

Here some code that may help:

[Embed(source='assets/arial.ttf', embedAsCFF='false', fontName='myArial', mimeType='application/x-font')]
   private var font1:Class;
var myCoreFont:IFont = new  CoreFont (FontFamily.ARIAL);
     myPDF.setFont(myCoreFont,8);


Of course this assumes you have the arial.ttf in the assets folder of your project.
0 Kudos
by Anonymous User
Not applicable
Original User: FrankTT

Robert,
I think that might be my problem. I commented this section of code due to errors during compilation.

/*    [Embed(source='assets/arial.ttf', embedAsCFF='false', fontName='myArial', mimeType='application/x-font')]
   private var font1:Class;
  
   [Embed(source='assets/esri_40.ttf',  mimeType="application/octet-stream")]
   private var fNorthArrow:Class;
  
   [Embed(source='assets/esri_40.ttf', embedAsCFF='false', fontName='esriNorth', mimeType="application/x-font")]
   private var fNorthArrowFont:Class;
  
   [Embed(source="assets/b617d5849ea5bacc44c29fc0d4c2bed6_esri_40.afm", mimeType="application/octet-stream")]
   private var afmNorthArrow:Class;   */

How can I get a hold of these missing .ttf files or is there a work around?

Thanx.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Frank,

  You should be able to search your machine and find these in the windows fonts folder.
0 Kudos
by Anonymous User
Not applicable
Original User: FrankTT

Thanks Robert.
The only error now is referring to esri_40.afm. I could not find that one.

[Embed(source="assets/b617d5849ea5bacc44c29fc0d4c2bed6_esri_40.afm", mimeType="application/octet-stream")]
   private var afmNorthArrow:Class;
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Frank,

   I forgot that I had to create that one.
0 Kudos