How to save SharePoint Site Page as PDF and save PDF to document library

Copper Contributor

I would like to know if it is possible to automate the process of saving a SharePoint site page as a pdf and then saving this pdf into a document library. Currently to do this I have to print the page (ctrl+p) and choose the option to save as pdf. Then once saved to my pc I upload the pdf file to the document library. Is it possible to have a webpart or button on the site page, which automatically does this for me using custom code?

5 Replies
No direct way to do that without some coding / Flow. Just as an example (a little bit out of date, but it's a good sample to look at):
Hello @Tiago_Sa, I have a similar requirement. Did you get any solution that could use CSOM for performing conversion?
Muhimbi, would be a 3rd party product. Is there a way to achieve this using CSOM?



i created a Windows Autohotkey ( script that runs off the sharepoint site pages list opened in chrome browser with send to pdf as the default printer in my chome print settings.


The script is


Sleep, 10000
Loop, 100 {
Send, {ENTER}
Sleep, 5000
Sleep, 2000
Send, {ENTER}
Sleep, 2000
Send, {TAB 3}{ENTER}
Sleep, 2000
Sleep, 1000
Send, {DOWN}



Save this as an .ahk file using Notepad. 


Open the site contents page in chrome and check send to pdf is set as the print setting:


Play the script using autohotkey(not going to explain that, do some googling research), click on an empty spot next to the first item in the list open in the chrome browser (within 10s) and let the script run, it will loop through up to 100 pages. It is sending standard windows commands that can be interpreted with some common sense upon a bit of study.


Note you may have to modify the script to match any differences in the order of your chrome browser print settings. Again i'm not going to help on customising this, it's just to give ideas on whats possible.


It does work well for an entire site for me.



Regarding your specific SharePoint question:
It is indeed possible to automate saving a SharePoint site page as PDF and storing it in a document library. This can be achieved through custom development, potentially using SharePoint Framework (SPFx), Power Automate, or server-side code. The solution would involve capturing page content, converting it to PDF, and directly saving it to the specified library.
Just as efficient shipping label printers automate and streamline logistics workflows, automating SharePoint processes can significantly improve document management efficiency.
Top shipping label printers offer features like one-click printing and automatic size detection. Similarly, your desired SharePoint automation would provide one-click PDF generation and automatic document library storage.
High-quality shipping label printers ensure clear, readable output. Likewise, a well-implemented SharePoint PDF automation solution would maintain the original page formatting and readability in the generated PDF.