To save a webpage as a PDF while retaining the links and formatting, use the following steps:
- Download/Install "SingleFile" browser extension
- Configure "SingleFile" with the following options which may directly impact the format of the generated PDF (save yourself the headache and match your configurations to the ones below):
- HTML content - compress HTML content : true - remove hidden elements : true - set content security policy : false - remove frames : true - save original URLs of embedded resources : true - do not include the saved date : true - save raw page : false
- Infobar - display an infobar when viewing a saved page: false
- Stylesheets - remove unused styles : false - remove stylesheets for alternative devices to screens : true - compress CSS content : false - move in the head element the styles found outside of it : true
- Images - group duplicate images together : true - save deferred images : true - dispatch "scroll" event : false - zoom out the page : false - remove images for alternative screen resolutions : true
- Fonts - remove unused fonts : false - remove alternative fonts : false
- Network
- blocked resources
- images : false
- stylesheets : false
- fonts : false
- scripts : true
- videos : true
- audios : true - block mixed content : false - pass "Referer" header after a cross-origin request error : true
- Annotation editor - default mode : normal - apply the system theme when formatting a page : true - warn if leaving page with unsaved changes : true - annotate the page before saving : false - open pages saved with Singlefile in the annotation editor : false
- Navigate to a webpage you want to save as a PDF (use Firefox as some browsers like Brave may not load certain resources needed to display graph/chart data correctly)
- Ensure other styles injecting extensions are disabled and click the "SingleFile" icon to save the current webpage and resources as a single HTML file
- Open the downloaded
webpage.html
in Brave or similar (Firefox may not preserve links in the generated PDF correctly) - Print the webpage and set the destination to "Save as PDF"
- Open and view the downloaded
webpage.pdf
which should look fairly similar to the original webpage with working embedded links
- Save a webpage as a PDF while retaining the original webpage format and with working links