0

I would like to somehow generate hundreds of PDFs (with embedded images) from a VF Page / custom controller. This requirement is part of a bigger package that is already using a lot of SOQL calls.

I'm not sure such a thing is even possible, but....

I would like to issue the necessary SOQL first (outside of the VF context), and then instantiate the VF pages in a loop through the list of records returned by the single SOQL call.

In the loop, each individual VF page instantiation would somehow be passed the specific data used in the VF Page. The loop would finish by saving the generated content (getContentAsPDF) as an attachment on a custom object. I don't need to actually show anything on the VF Page.

I won't be able to query the data using SOQL in the controller itself without exceeding governor limits - I would like to pass in the values somehow - perhaps by setting controller class member variables (lists).

I don't see any way to access an instantiated VF Page's associated custom controller object instance. Nor do I see a way to associate a new VF Page instance with a previously instantiated custom controller object.

I have used Blob methods in the past for this kind of thing, but that approach doesn't work with graphics - the styling of the VF page is what I'm after, without having to issue SOQL calls in the controller for each instantiation of the VF page when 100s (or 1000s) are needed....

Is such a thing even possible?

4
  • What works for one record/page, can be used to work for many from a list view perhaps? Have you discounted that approach? Commented Dec 12, 2014 at 16:30
  • Conga Composer might be an option - it can render from SFDC data MS Office templates (like Word) as PDF and save as attachment to each record used in the Conga job. Job can output up to 1500 records (I think). Will cost $ but vendor has great support
    – cropredy
    Commented Dec 13, 2014 at 1:32
  • Or -- appexchange.salesforce.com/… created by one of SFSE's own !
    – cropredy
    Commented Dec 13, 2014 at 1:39
  • Thanks Phil Hawthorn for the reply - but I'm not sure how a list view controller for the VF Page can actually generate separate PDF files, one row at a time, without actually issuing multiple SOQL calls to populate the report's fields....and I'm hoping to avoid costs on this...
    – newbie
    Commented Dec 14, 2014 at 14:03

0

You must log in to answer this question.

Browse other questions tagged .