function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mackendw@gmail.commackendw@gmail.com 

Problem with a pdf attachment on an Opportunity - Internet Explorer + Adobe Acrobat plugin

Hi:

 

   I have a VF section on Opportunity.  It has a button on the page to export the content as a pdf which is then attached to the opportunity.  The output is renderAs='pdf'.  Works fine with FF, Chrome....however, in IE 8 | 9 it complains that the file being opened when you click on the View File dialog is corrupt or broken.

 

   Any idea what is going on?

 

   Here is the code in the controller class that does the work:

 

    String attachmentName = 'outputPDF';

 

    Id oppId = apexpages.currentpage().getparameters().get('id');

    

    PageReference pdf = new PageReference('/apex/outputPDF?id='+oppId);

 

    pdf.getParameters().put('id',oppId);

     

    Blob pdfBlob = pdf.getContent();

 

    if (pdfName == null || pdfName.length() == 0)

       pdfName = attachmentName+'.pdf';

   

    Attachment saveAtch = new Attachment(ParentId = oppId, IsPrivate = false, ContentType = 'pdf', Name = pdfName, Body = pdfBlob);

 

    insert saveAtch;  

    

 

Note that the outputPDF VF page has renderAs='pdf' in the apex:page parameter.  Works in FF & Chrome, not in IE.

 

??

Best Answer chosen by Admin (Salesforce Developers) 
mackendw@gmail.commackendw@gmail.com

The problem is corrected by adding the full URL to the force.com server prepended to the /apex/Opportuty... url.  Why...no clue.

 

Also, when Development Mode is enabled for a user profile, this causes the pdf generation to go ape**bleep** also.  Is this a known issue?