Skip to content Skip to main navigation Skip to footer

Email a Link That Exports and Downloads a Google Doc as a PDF when Clicked

You can create a formula field that creates a URL which exports and directly downloads the Google Doc as a PDF when you click it. The formula creates a link that lets you directly download a PDF of the Google Doc when clicked. Once downloaded, you can then save the PDF.

See below for an example of the URL format for a direct PDF download. You need to place the Google Doc Id where “FILE_ID” is:

<https://docs.google.com/feeds/download/documents/export/Export?id=FILE_ID&exportFormat=pdf

You can create a formula field to get the Google Doc Id out of the full Google Doc URL. In this example, the field with the full google doc URL is called Proposal_Link__c but you would use the API name of custom field you  created:

MID(Proposal_Link__c, find(‘/d/’,Proposal_Link__c)+3, find(‘/edit’,Proposal_Link__c) – find(‘/d/’,Proposal_Link__c)-3)

If you have a URL field called Google_Doc_URL__c saving the Google Doc Id, this would be the formula to create this URL:

https://docs.google.com/document/d/"+MID(Google_Doc_URL__c, find(‘/d/’,Google_Doc_URL__c)+3, find(‘/edit’,Google_Doc_URL__c) – find(‘/d/’,Google_Doc_URL__c)-3)+"/export?format=pdf

Note: While Opero Documents can generate a Google Doc (from an existing Google Doc template) and email it with PDF attached, Opero Documents can’t export an existing Google Doc to a PDF and email with PDF attached. It only does that when generating the document from a template.