If your job involves converting files into PDF manually, you know the drill: Open the file, click File, Export, Download as PDF, and then download it again. It’s a lot of clicks!
In my latest video, I’m going to show you how to ditch the manual process and use SharePoint Buttons to get the job done right from your document library. We’ve got three methods to cover, ranging from quick deep links to my personal favorite: Power Automate.
The Methods at a Glance
| Method | Best For | Supports |
| 1. Word Deep Link | Quick Print/Save | Word only |
| 2. Fast Browser PDF | Speed & Preview | Word, Excel, PowerPoint |
| 3. Power Automate | Full Automation | All Office Files |
Method 1: The Word Print Link
This is a simple deep link that opens your Word document directly in “Print Mode” within the browser. From there, you just hit print and save it as a PDF to your local machine. It’s a great entry point, but keep in mind it’s limited to Word documents.
Method 2: The Fast Browser PDF
This one is a level up! It’s significantly faster and supports Excel and PowerPoint too. With one click on your SharePoint button, the PDF instantly opens in your browser tab, ready for you to save. No waiting for applications to load—just click and go.
Method 3: The Power Automate Workflow (My Favorite!)
You know I love automation, and this is the “gold standard.” By calling a Power Automate flow from a SharePoint button, the heavy lifting happens behind the scenes.
- No manual saving: The flow grabs the file, converts it, and saves the PDF directly back to your SharePoint library.
- Input Parameters: You can even set it up to ask for an email address or extra notes before it runs!
How to set it up
It’s easier than you think! You don’t need to be a developer to use these. It’s all about Column Formatting.
- Create a new text column in your library.
- Go to Column Settings > Format this column.
- Switch to Advanced Mode and paste in the JSON code.
I’ve shared the code for all three methods below so you can try them out as a proof of concept.
Check out the full walkthrough
Want to see these buttons in action and get the code? Watch the full video here:
Have you used buttons in SharePoint before? I’d love to hear your ideas for automation in the comments!
Code Snippets
Below you will find the samples for Print to PDF, Download as PDF and Run a Flow. Note for run a flow, you will need to update the flow ID, details of which as in my earlier video shared below.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "a",
"txtContent": "Download PDF",
"attributes": {
"target": "_blank",
"href": "=@currentWeb + '/_layouts/15/WordViewer.aspx?id=' + [$FileRef] + '&DefaultItemOpen=1&PdfMode=1'",
"role": "button",
"title": "Open for PDF Print"
},
"style": {
"display": "=if([$FSObjType] == '1' || (indexOf([$FileLeafRef], '.docx') == -1), 'none', 'block')",
"text-decoration": "none",
"padding": "6px 12px",
"border-radius": "16px",
"text-align": "center",
"cursor": "pointer",
"background-color": "#0078D4",
"color": "#FFFFFF",
"border": "1px solid #005A9E",
"box-shadow": "0 1px 2px rgba(0,0,0,0.1)",
"font-weight": "600"
}
}
]
}
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "a",
"txtContent": "Download PDF",
"attributes": {
"target": "_blank",
"href": "=@currentWeb + '/_api/v2.0/drive/items/' + replace(replace([$UniqueId], '{', ''), '}', '') + '/content?format=pdf'",
"role": "button",
"title": "Download this file as PDF"
},
"style": {
"display": "=if([$FSObjType] == '1', 'none', 'block')",
"text-decoration": "none",
"padding": "6px 12px",
"border-radius": "16px",
"text-align": "center",
"cursor": "pointer",
"background-color": "#0078D4",
"color": "#FFFFFF",
"border": "1px solid #005A9E",
"box-shadow": "0 1px 2px rgba(0,0,0,0.1)",
"font-weight": "600"
}
}
]
}
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Create PDF",
"attributes": {
"title": "Create a PDF"
},
"style": {
"display": "=if([$FSObjType] == '0' && (endsWith([$FileLeafRef], '.xlsx') || endsWith([$FileLeafRef], '.docx') || endsWith([$FileLeafRef], '.pptx')), 'block', 'none')",
"text-decoration": "none",
"padding": "6px 12px",
"border-radius": "16px",
"text-align": "center",
"cursor": "pointer",
"background-color": "#0078D4",
"color": "#FFFFFF",
"border": "1px solid #005A9E",
"box-shadow": "0 1px 2px rgba(0,0,0,0.1)",
"font-weight": "600",
"outline": "none"
},
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"451dd4fb-3780-415f-a62d-5325f3c779ce\"}"
}
}