1

I have created a customer signup form using VF page and Html Tags. In Account object I have created one formula field to reach this form via Account object. If the user reach the form via account the Account details should be auto populated in the form and there is one place available for getting the customer signature. I have done all the above said process but I am facing some issues while I am trying to save this form as a PDF in the attachment of the particular account.After the PDF generation the PDF should be sent as a Email to the user automatically via code. We tried both renderAs='PDF' and getContentAsPdf() but we are getting the same error "PDF Generation Failed Check the Page Markup is valid" Can any one please guide me on the PDF generation part?

  • Please add some code .And Pdf markup failed means there is something wrong in the visualforce code .So first remove RenderAs='pdf' and use in normal and then try debugging – Mohith Shrivastava Jan 7 '14 at 7:19
1

If your visualforce page (page which you are rendering as pdf) is working properly then please see following code to get visualforce page content as pdf.

PageReference pageRef = new PageReference('/apex/MyPage');
pageRef.getParameters().put('id',account.Id);
Blob pdfBlob = pageRef.getContent();

Now you can use this Blob data to send as an attachment.

Just for an information, I'm using this code in different visualforce page controller than the one which I'm rendering as pdf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.