+ Start a Discussion

Question to Reid Carlberg


Is it possible to addresss a question to Reid Carlberg ? I want to write to him as an "App Evangelist". I am an SF administrator / Developer, and I'm looking for a solution to allow a mass / batch production of VisualForce page to be PDF'd and downloaded / Sent by email.
The idea is that if each page represents a document (Invoice / Timesheet / Etc.),  sitting around generating say 200 of these, takes a long time. Printing each seperately, also takes a long time.

I'm looking for any app / idea that someone out there may have.


Hi Ben,

Thanks for the note and nice to connect with you.  Re: your question, I don't know of an existing app that does exactly what you describe but there are a couple that create PDF's from VisualForce pages that you could probably use as a way to start.


One is Simple Quote 1.0 -- it creates a PDF and can send via Email -- and another is Sales Quotes with Line Items -- it creates a PDF and attaches it to an object.  Neither of these are likely to work for you out of the box, but both are likely to give you pointers on how to implement the solution you need.


Side note -- I was at Cloud Force Chicago yesterday and ran into someone from the ecosystem I've know for a few years -- and he described how he used Force.com Labs apps in a similar way to create a robust project management solution for a client.  Rather than start from scratch, he pulled bits and pieces from two or three apps and linked them together.  It was quick and worked for him.


Two final things.  There's also a great Wiki article on the PDF's that I'd recommend -- check it out. And if you're new to Apex dev, start with the smallest and simplest solution that could possibly work.  If you try to do too much at once, it will be very difficult to debug and learn.


Hope that helps!







Hi Reid,

Thank yo for your answer. I feel I did not express myself properly,


I have already developed a PDF solution around VisualForce. What I am concerned with now is the batch creation of multiple such invoices.


I would welcome any ideas you may have in this regard.


Thanks again.




Ah ha.  So on the batch side, what about it isn't working?  Did you try modifying this block of code:



PageReference quotePDF = Page.quotePDF; // new PageReference('/apex/quotePDF'); /* set the quote id on the page definition */ quotePDF.getParameters().put('id',quote.id); /* generate the pdf blob */ Blob pdfBlob = quotePDF.getContent(); /* create the attachment against the quote */ Attachment a = new Attachment(parentId = quote.id, name=quote.name + '.pdf', body = pdfBlob); /* insert the attachment */ insert a;


to iterate through a list of invoice ID's (or whatever you need to use as the parent object)?


(This is from the Quotes with Line Items, salesQuotes.cls, attachQuote method.)




I was using that exact block of code, and attaching it to the object. but I would like to create a single email with the attachments. hopefully, with a single attachment.




So you have 200 invoices.  You want those combined into a single PDF.  You want to email that PDF to a single address?


Is that correct?

Have you tried enabling Extended Mail Merge in your org, and then see whether there is a way to hook up the code that you have written?

I'm not sure what is the relation between XMM and the code which creates attachments. in any case, It was my understanding from Support that XMM can only pull information from one type of object, that is to say, it cannot collect all detail records and place their info in the same document as the Master.


Do you think they were inaccurate?


Thanks for your help in this. 

Message Edited by beener3 on 03-23-2010 02:15 AM
Ross JamesRoss James

Does anyone have anything more to add on this? I too have a situation where I need to produce bulk PDF documents (e.g. 200 invoices to be produced as a single PDF for printing).


I am new to Visualforce PDFs, and after creating a few I am now stuck as to the options on 'using' them.


While attaching them to email is great, I will have a good need to 'batch' them for printing, etc.


Hi Ross,


The right  solution on this will depend on your needs.  If you're looking to create a large VF -> PDF, that should be possible, but then your goal is to send it to a printer automatically or to simple open it in a browser and click print?



Ross JamesRoss James

I would be happy with either right now. This is rather urgent.


Moving forward, I would like the opportunity to do both.



  • Create a single PDF with 200 invoices that is emailed to a user
  • Create a single PDF with 200 invoices that is sent to a printer (no need to be saved as a PDF)


Pranav MarathePranav Marathe



Has anyone found a solution for this?





I need to uninstall GoogleAlertstoChatter.  Love the app, but we are far from a Chatter friendly environment so far.  I went through the main steps to uninstall 

I am not caught in the loop of "can't delete because referenced elsewhere" Apex Class, Visualforce page, Chatter News Alert Setup, Custom Tab.  I successfully deleted the App, but I am needing to unravel the other steps.  Could you please direct me to the order or elimination.  Thanks.