Mac Exporting all Apple Notes to PDF

marmiteturkey

macrumors 6502a
Original poster
Aug 27, 2005
681
434
London
I have a bunch of handwritten Apple notes (using the iPad Pro/Pencil) - I'd like to get them all into individual PDFs for importing/sharing/archiving. I can't find an AppleScript or similar that would do that - can anyone help? Printing individually would take an age; drag and drop doesn't work; and the only scripts I can find only deal with text or attachments.

Thanks,
MT
 

Cordorb

macrumors regular
May 8, 2010
211
50
I have tried an old program that does iPhone Backup extraction from your own non-protected backups

useful for extracting photos, videos, Photo Stream, call history, notes, contacts, calendars, SMS messages

Not sure if the notes were in PDF format
 

marmiteturkey

macrumors 6502a
Original poster
Aug 27, 2005
681
434
London
I'm back here and still don't have an answer to this - I found an old AppleScript but it has errors in it and I am in no way qualified to debug it :( - can't believe this isn't easily fixable - it must be something that people struggle with constantly? Without an easy way to bulk export handwritten notes, it's essentially off limits to me.
 

superscape

macrumors 6502a
Feb 12, 2008
930
218
East Riding of Yorkshire, UK
Hi,

I think the main issue is that there doesn't seem to be any way to tell Notes to output a PDF in the AppleScript dictionary. You can, however, get the name and contents of each note and add them to something that *can* be converted into PDF. Something like this very crude example I lashes together:

Code:
--start the HTML text
set theSourceHTML to "<html><body>"

tell application "Notes"
  
    activate
    set theNoteList to every note
  
    repeat with theNote in theNoteList
        --add to our HTML for each note
        set theBody to body of theNote
        set theName to name of theNote
        set theSourceHTML to theSourceHTML & "NAME: " & theName & "<br>BODY: " & theBody & "<p>---<p>"
    end repeat
  
end tell

--end the HTML text
set theSourceHTML to theSourceHTML & "</body></html>"

--write the html to file
do shell script "echo " & quoted form of theSourceHTML & " > ~/Desktop/notes.html"

--convert the html to pdf
do shell script "cupsfilter ~/Desktop/notes.html > ~/Desktop/notes.pdf"


...it goes through each note, gets it as html and then created a pdf from the html. You'll probably lose images and possibly lose some formatting, but I suspect that may be the best you'll get.

Hope that helps at least a little.
 

chown33

Moderator
Staff member
Aug 9, 2009
8,815
5,218
vertical
...it goes through each note, gets it as html and then created a pdf from the html. You'll probably lose images and possibly lose some formatting, but I suspect that may be the best you'll get.
I see that Notes on a Mac can import formats like rtf and rtfd. This suggests it's using the Cocoa text conversion system.

There's a command-line tool that supports those same conversions: textutil.

Maybe if Notes can be told to export as rtfd (or a similar format), that can be processed by textutil into HTML (or similar), and then converted to PDF through the cupsfilter as shown above.

I don't have any Macs here running the Notes app, so I can't explore this myself.



On a different note, it might help us make more progress if the OP were to post the exact URL of the script that doesn't work. He says he can't debug it, but that doesn't mean no one else can. However, he's the only one who knows what that script is, which does mean no one else can do anything with it until he tells us exactly what the script is.
 
  • Like
Reactions: superscape

forrie

macrumors member
Mar 6, 2008
53
15
I just wonder why Apple didn't include a simple function to print multiple, selected notes into one PDF. That seems so obvious of a need.
 
  • Like
Reactions: BigMcGuire
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.