1

Is there a way to map fields of an existing PDF document using APEX/VisualForce with the relative data from Custom/Standard objects?

Here is the situation - There is an existing PDF document and we prefer to map data from Objects to the fields on PDF document (similar to form) using APEX. Is it doable to map fields directly to PDF without re-creating/re-generating/re-rendering the document?

Thanks.

0

It would depend on whether or not the VF page that creates the existing PDF document uses a custom controller. If it doesn't and your combination of objects doesn't require a custom controller, then yes, you could edit the code on the VF page to reference fields from another object.

If the new objects you want to output on the edited page can't be accessed from a standard controller, you'll need to write a custom controller in order to reuse the VF page that generates the PDF.

Regardless, you'll need to understand how the page itself works before you begin editing field names on the page, controller references, etc.

2
  • Thanks for your response. The issue here is we don't want to have a VF page, we already have a pdf form and with the click of a button, controller should map all fields with their corresponding fields from Object. I hope this clear the confusion? – Uncle Larry Jan 22 '15 at 17:52
  • In actuality, the button you have causes a VF page to "render as" a PDF when it's displayed. In the header at the top of the VF page, you'll see where the renderAs="pdf" attribute has been set in the <apex:page> tag. I suggest you look at your button code to identify the name of the VF page that generates your PDF along with any associated controllers required to support the page as referenced in the <apex:page> tag. Hope this helps clarify your understanding of how PDFs are generated. – crmprogdev Jan 23 '15 at 1:20

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.