Avoiding large page margins in PDFs clipped from Safari

I have stopped using the DEVONthink extension in Safari to save webpages to PDF in DEVONthink because I do not like how it handles margins.

I have a 27" screen and my Safari window is usually much larger than the defined width of the websites I am looking at. There is a large amount of white space in the browser window on either side of the content (see image 1). If I use the DEVONthink extension to clip a webpage and save to a PDF file in DEVONthink, the resulting PDF includes all of the white space in the PDF, which is a waste.

As far as I can tell, the only way to get the DEVONthink extension not to make white space in the margins is to manually reduce the size of the Safari window so that it fits, or is SMALLER than, the webpage content. Then the DEVONthink extension makes a PDF that does not have excessive margins. But it is a real pain to have to change the window size, clip to DEVONthink, and then restore the window size.

The alternative that I found is to use AppleScript and not use the DEVONthink extension at all. I wrote an AppleScript that sends the URL of the current Safari tab to DEVONthink and has it make a PDF using the “create PDF document from” command. This results in a PDF like image 2, but it does not have the convenience of the extension toolbar icon and the ability to specify a destination group, comments, tags, etc. I realize I could do all that with AppleScript, but to write all that code seems like reinventing the wheel when there should just be someway for the DEVONthink extension not to include all the white space in the margins in the first place.

Is there a way to do this? Can the DEVONthink extension be set to make its PDF files based on the width of the webpage content, not the window?

Thank you,

Image 1: PDF created with DEVONthink Safari Extension

Image 2: PDF created via AppleScript

This is the shortened form of the AppleScript that I use instead of the DEVONthink extension:

tell application "Safari" to set theURL to the URL of the front document
tell application "DEVONthink Pro" to create PDF document from theURL