Recently I noticed that Keep!It PDF has a setting to set the width when capturing PDFs. Would it also be possible to add such an (optional) setting on DEVONthink? It would make for more consistent / usable PDFs.
When capturing a PDF via the Safari web clipper (using the icon) the width is determined by the current Safari window size. But when clipping via the Share extension (using the Share extension and choosing āAdd to DEVONthinkā) the width seems independent from the window size.
That makes sense, but does this also mean that the share extension uses a default width for capturing PDFs? That would in some cases be preferred (to not end up with completely different scaled PDFs)
Thanks. Iām still trying to wrap my head around whatās actually happening when DT captures PDFs:
When using the Safari extension DT uses information from the browser (width, title, ā¦) and creates a PDF based on the current browser width.
When using the Add to DT share extension it does not use browser specific information (it probably only gets URL and title?) and creates a PDF based on certain defaults (which arenāt configurable for the user)
But thereās another interesting difference in the outputs (using the URL of this page as an example). Because you can also use the in-app DT3 browser to capture.
Using the methods above (via web clipper / share extension) both pages are captured in a (sort of) print layout (and interestingly /print is added to the URL - not sure if DT is doing that or Discourse through some JS/CSS @media magic?).
But when creating a bookmark in DT and capturing this page subsequently it creates a near-perfect copy as view in the in-app browser. See below for the differences:
Using the Safari extension or Add to DT share extension:
By the way: my current workflow is that Iām running DT3 on a separate Mac with predefined workspaces / in-app browser sizes so Iām always capturing the PDF formats I want. But a more robust solution like Keep!It by being able to set a specific width would be great.
Thanks. As I was looking for a script that saves a PDF of the current view I was happy to notice that the script from this 14(!) year old post still does the trick (with some minor updates) Capture PDF document to current group
tell application id "DNtp"
try
if not (exists think window 1) or not (exists content record of think window 1) then error "No window/document is open."
set theWindow to think window 1
set theURL to URL of theWindow
set theName to name of theWindow
set thePDF to PDF of theWindow
if exists current group then
set theRecord to create record with {name:theName, type:picture, URL:theURL} in current group
else
set theRecord to create record with {name:theName, type:picture, URL:theURL}
end if
set data of theRecord to thePDF
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
Using Script Debugger (which indeed has better documentation than the standard Script Editor - thanks Pete) I found out the create PDF document from actually just has a width argument which works exactly like I want. Iām now using this script:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application id "DNtp"
try
set theURL to "https:///www.devontechnologies.com"
set thePDF to create PDF document from theURL width 800
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
Yes, itās really great ā plus, the fact that you can log in to a website within DEVONthinkās browser means that you can capture pages behind paywalls.
If you are going down this road of opening pages in DEVONthink and then creating a PDF from it, you may be interested in reading the following forum postings,
While true this often works - and is our advocated method in such cases, we cannot reasonably guaranteed it 100%. However, the averages are high enough itās a good option to try.
Thanks for pointing these out
again. Iāve looked at your scripts before and they are indeed very helpful. Iāve used some your ideas before in GitHub - mdbraber/save-safari-pdf: Automatically open websites in Safari and Export as PDF (converting that to a full DT approach. I also have a working set of scripts specifically to capture all of my LinkedIn profiles including contact info.
One thing: it seems that because your approach is dependent on the window width / UI - the width from the Applescript command cannot be used. How are you solving the width āissueā? By just keeping the window at the same size?