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