Sony Reader Notes to SVG or PDF
by Alessandro Bruni
I recently bought a Sony PRS-T1 ebook reader and it turns out it has a very nice feature: it’s possible to sketch notes and little drawings using the touch screen. Then you can export them using the “take a snapshot” feature, which creates an image from the canvas.
What if you wanted to have them exported to any vector based format? It turns out that the format of the note files is a wrapped SVG with a container element and a couple of namespaces. To get an SVG file we just need to unwrap them. And you don’t even have to bother XML processing, you just need a simple sed command in any Unix-like (Linux, OS-X etc) environment:
#!/bin/bash
sed "{ s/n1://g; s/<n0:notepad.*<svg/<svg/;s/<\/n0:page.*notepad>// }" $1
Save this to /usr/local/bin/note2svg with your favorite editor and make it executable:
chmod +x /usr/local/bin/note2svg
Whenever you want to get the SVG file from the reader you’ll just have to open a terminal and type:
note2svg input_file.note > output_file.svg
If you also want to convert the SVG file to a PDF you’ll need to have Inkscape installed and type:
inkscape input_file.svg --export-pdf=output_file.pdf
Enjoy your notes
Edit: here is a little Windows app that does the same. You need the .NET 2.0+ framework, so I guess it will run in any decent Windows version (starting from 2000).
This is a nice idea. I really love this hint. Have to look into this myself a little bit as it would be nice to be able to overlay the svg thing again onto the pdf. any idea on how to do this?
What do you mean by this? the last command (inkscape blabla) converts your svg file into a pdf, but maybe it’s not exactly what you want. Am I getting it right?
Dear god, really appreciate this post, saved my huge bunch of time. I bought this device to substitute my old EINK iliad with a wearing out battery. Everything went pretty well but note taking export will really be a problem for it.
I can’t figure out how to merge pdf’s hand writing.
so with this method I might try to export PRS T1′s pdf hand note taking and merge the note with original pdf if it is possible.
Yeh probably one could write a script that takes the original pdf and the associated notes and merges them into a new pdf, ready to be used in your pc.
Right now I don’t have time to check this out, but I’ll sure do cause I’m also interested
Let me know if you find a way to do that.
Cheers
As far as I understood this only works with additional notes. I could not figure out how to access the notes that are taken inside a book, with the annotation feature.
It does indeed. I was just interested at that feature when writing the script. Finding where the pdf associated notes are stored would be useful.
I guess we are just one step away from that.
I think the associated notes are stored inside a database on the reader. they are different to the additional notes not directly accessible via the file system.
I found the place where these are stored: they live in
READER/Sony_Reader/database/cache/books/book-id/markupand you can get the place where they are stored fromREADER/Sony_Reader/database/books.db, which is an sqlite3 database and has a table called annotation for this purpose.The rest is just matter of coding the script to extract this information from their database and bundling a new PDF with the two info combined. It shouldn’t be too hard, but right now I’m concentrating on my master thesis
Will try to do this as soon as I have free time
Thanks to this information, I was able to write a script to output a PDF containing freehand annotations made on the PRS-T1. If you’re interested, you can find it here: https://github.com/rschroll/prsannots. No support yet for annotations made to highlighted passages. These are easy enough to get from the database, but I need to learn how to add annotations to a PDF file.
Thanks for the tool, I will take a look at the source code and maybe will try to help you with what is still missing
It is so good to have this feature out of any Sony proprietary tool. Maybe if this works well it can be integrated with calibre!
Any help you can give is certainly appreciated. Feel free to file bugs with problems, suggestions, or just ideas. I’ve already created one with what I know so far about highlighting.
Thanks!
I am finishing a toxicology PhD and spend 12-16 hours a day looking at microscopes and reading off an LCD screen. My eyes hurt. SONY has had good PDF reading ability since the PRS-600/900 series. But it never had the ability to import my highlights and notes. What you made is AWESOME!!!! thanks o much. I have been looking for such a feature for a year now. I hate to insult your linuxness, but is there a way to do this in a windows XP based system?
Hi Pete! The linux script is just a sed command that unwraps the .note files in your reader to get the inner svg document. Maybe I can make a small exe that does the same.
But probably you want to take a look at Robert’s program (see comments above) although I think it might be hard for you to set up the necessary dependencies (python, reportlab, pypdf) with that you should be able to bundle your freehand annotations into pdf files.
I made a little windows program that does the same trick, you can find it here:
http://alessandrobruni.name/pub/NoteToSvg.zip
[...] [...]
Ohh my. You are fast. That was above the call of duty. Thanks SO much. I was borrowing a friends PRS-900 last week. I will order a PRS-t1 today.
I tried to look at this program with notepad and figure out what i need to have installed to run it. Do i still need inkscape, python 2.7, and pyPDF? Do i need to have the T1 plugged into the USB? Do i need to remove the SVG files and put them on my PC first? I am sorry to be asking for even more but could you give me some instructions.
This is going to save my eyes and let me catch up on the many ecology articles my boss keeps throwing at me. Thanks so much.
It’s the same reason I bought it for
Alas I don’t have a windows machine to test the procedure.
I guess you have to, in order:
1. install python 2.7 32bit (http://python.org/download/)
2. install pypdf (http://pybrary.net/pyPdf/)
3. install reportlab toolkit (http://www.reportlab.com/software/opensource/rl-toolkit/download/)
4. download prsannots (https://github.com/rschroll/prsannots) you can click on the zip icon in the page to get the whole thing
5. put python on your PATH env variable (this depends on your os version, look online and you’ll find instructions)
Having done this setup you would be able to run Robert’s code by calling:
python prsannots
from the command line in the directory where you extracted prsannots. It’s a command line tool so don’t expect any GUI
Let me know if everything works fine.
“It’s a command line tool so don’t expect any GUI
”
My brain is a little GUI. hahaha
This will be a good thing to learn to do. Thanks. It might take me some time but to have a PDF with the scribble on it on my PC when i finaly write my thesis will be GREAT.
I will report back when i get the T1 and install all these programs. Many thanks. Pete