Export a "clean" PDF?

devonthink3
automation
#1

I have been using DT since version 1, and am loving the new DTPro3. Thanks for all your hard work.

Is it possible in DTPro3 to export a pdf, without its annotations (i.e. the notes, highlights, lines within the pdf itself)? When I share a pdf from my database with colleagues, sometime I do not want to send them all my comments, notes etc. I notice that Bookends has this option.

2 Likes
#2

Thanks for the kind words!

There is no such option available - and the first request I’ve ever seen.

#3

You could make a copy before editing so you have a clean copy to send

OR

Get MarginNote 3 App. It can export PDFs without its edits.

#4

It’s a little late for that!

Thanks. I’ll take a look. It looks very interesting.

I had hoped to be able to do this from within DT. Of course it is possible to use Preview, and to delete all annotations from within the Inspector. But a script would be handier. I have one in Python, so I’ll see if I can integrate it.

For reference (for anyone else), in Bookends, File > Export Attachments can export with or without Annotations.

#5

Yes for some reason of their “own” DT has neglected the PDF side of the app. I was hoping a better version with DT3 but it looks nothing was touched. But maybe one day :slight_smile:

Of course there are only two hands to do so much :wink:

#6

Actually such a feature would be very helpful, although there are more pressing issues i guess. I also have to keep extra clean copies of each (of thousands of) research articles so I can share them with colleagues so they don’t get my annotated files. It is often difficult to obtain articles that require subscriptions that your university does not have. So we have to share a lot. This keeping of extra copies is a pain because most of the pdfs are never shared. If I remember correctly, such a feature was implemented in Bookends. I could imagine an option (in Preferences) that saves a clean copy of a pdf as soon as I start annotating it, and then i could retrieve/share that clean copy from the context menu.

Let me describe a typical situation: I skype with a colleague and we talk about topics or literature, and, simultaneously, I search in DT. Then I get a couple of good hits (pdfs). Now I want to send them over to my colleague, but without annotations. Currently, that’s difficult: I have to manually retrieve each of those pdfs from my store of clean copies. That store is alphabetically organized, so it might take 10 minutes to find them all. In an ideal (DT-)world, I would just mark them and select a command “share clean copy” :slight_smile:

have a nice day

1 Like
#7

I’ve just started with DT3, but maybe one could use the new Smart rules to make DT save a clean copy of a pdf once you drop the pdf, e.g., into your main literature group. Then one only needs to think of a clever way to retrieve those duplicates if needed.

#8

Besides Bookends PDF Expert and other PDF-Apps offer this as standard.

#9

Here is a script I have written. It works well for me, but let me know if you have any problems.

(*This script will allow you to export a selected PDF record without
any PDF annotations.

It requires the pdfrw Python module to be installed. In a terminal
window, you might try:

	pip install pdfrw

or

	sudo /usr/bin/easy_install pdfrw 
*)

-- Set the path to your Python interpreter here. Change this if 
-- you want to use a version of Python other than that which 
-- comes with MacOS
set python to "/usr/bin/python"

tell application id "DNtp"
	set theSelection to the selection
	if theSelection is {} then
		display dialog "Please select a record" buttons {"OK"} ¬
			cancel button "OK" with icon stop
	end if
	if (count of theSelection) is not 1 then
		display dialog "Please select a single record" buttons {"OK"} ¬
			cancel button "OK" with icon stop
	end if
	
	set theRecord to the first item of theSelection
	if type of theRecord is not equal to PDF document then
		display dialog ¬
			"The record you have selected is not a PDF file" buttons {"OK"} ¬
			cancel button "OK" with icon stop
	end if
	set theName to the filename of theRecord
	set thePath to the path of theRecord
	set outputFile to the POSIX path of (choose file name with prompt ¬
		"Export as" default name theName default location path to desktop)
	do shell script python & " -c " & "\"import sys
try:

    from pdfrw import PdfReader, PdfWriter
except ImportError:
    print('Cannot find pdfrw module. Try pip install pdfrw')
    sys.exit(-1)

pdf=PdfReader('" & thePath & "')
for page in pdf.pages:
    page.Annots=None
output=PdfWriter('" & outputFile & "', trailer=pdf).write()\"" with administrator privileges
end tell
2 Likes
#10

+1 for having this built in. After I have annotated a PDF, sometimes I want to share the annotated version, and sometimes I want to share the original. Both are useful.

#11

I’ll voice my support for this feature. I need to send clean PDFs to people multiple times a day. I’ve gotten in the habit of duplicating the PDFs outside of DT and then stripping the annotations with Acrobat before sending. It would speed things up considerably and be much more convenient if such a feature were built into DT.

#12

feature request: I would strongly support this feature suggestion also from my side (share pdfs without annotations/highlighting). @cgrunenberg

#13

Interesting approach.

#14

Thanks for the suggestions! Just wondering now what would be the best implementation. A command Data > Convert > to PDF without Annotations? The PDFs could then be processed afterwards in any desired way and not only exported.

2 Likes
#15

yes. Ideally, it would be possible to apply the “Convert” command to a bunch of selected pdfs. So I could collect pdfs for sharing in a group or using a tag, and then convert them in one go.

1 Like
#16

Beta 2 will include this.

4 Likes
#17

Perhaps this could be done in a smart rule if the Convert > to PDF without Annotations action was available. You could do this on demand with a selection of PDFs or by dropping PDFs on the smart rule.

@cgrunenberg?

#18

It’s of course supported by smart rules and AppleScript :smiley:

#19

This all sounds excellent! Now if you can just add an integral python interpreter as well … :wink:

#20

I could append this to the to-do list of course but probably you don’t want to wait til the next century :slight_smile: