0

I have "Generate Attachment" button on VF page. when i click on that button. The Same VF pages Save as Pdf in "Notes & Attachment releted list" in Opportunity object. But Pdf Showing the Marks of button on it. So how to Remove the Marks of Button from PDF and I dont want to use RenderAs = "pdf"

Below Pdf Image

enter image description here

my controller is

public PageReference attachPDF() {
    SaveAttachment  = true;
    PageReference pdf =  new PageReference('/apex/MyPageThatGeneratePdf'); 

    Blob body = pdf.getContentAsPDF();
    Attachment attach = new Attachment(); 
    attach.parentId =  oppid;
    attach.Name = 'PDf ';
    attach.body =body;
    attach.IsPrivate = false;
    insert attach;



     return null;
      }  

and VF page is

<apex:commandButton value="Generate Attachment"  action="{!attachPDF}" 
            rendered="{!$CurrentPage.Parameters.flatid != null && !SaveAttachment}" 
            style="margin-right:4px;"   />    

1 Answer 1

0

I assume that you are using the same Visualforce Page for creating the PDF. You could try using the following style :

<style type="text/css" media="print">
.btn { display: none; }
</style>
1
  • Yeah I used this but It is not working.
    – Sfdce
    Commented Jul 12, 2016 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .