My question is regarding Save Pdf as in Notes and Attachment under the record,

So, my issue is,

First controller is fill the document(PDF) and Second controller can Save that PDF using that first Controller, How can i Do this ?

Or any other solution to save this PDF in Notes and Attachment ?

Please Help..

Thank you.

  • What is the criteria on which you need to generate the PDF?
    – RajeshShah
    Aug 27, 2015 at 10:55
  • My question is i do have a page which is called from custom button from contract object, when i click on that button page is renderAs pdf and after that i want to save the pdf to the contract object (In Notes And Attachment). In Controller there is a logic which is bringing text Block of this pdf and merging the field of contract so, this action performs in the constructor of the controller. Now, please tell me how can i SAVE this pdf ?
    – Nihar
    Aug 27, 2015 at 11:17
  • You say Without clicking a button - Check out BatchPDF on the app exchange
    – Eric
    Aug 27, 2015 at 14:01

1 Answer 1


You will need the following:

  1. A visualforce page which is rendered as PDF (I believe you already have it)
  2. Create a new VF Page and a Controller. The Controller will do a getContentAsPDF for your PDF page. The blob that it gets from the PDF page, it will store it as an Attachment under the record.
  3. Add a button on your object which will the call the VF page in point 2.

You can read this in more details at the following links:

This site is temporarily in read-only mode and not accepting new answers.

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