Resources How to convert PDF Flashcards into a Deck on Anki (self.Anki)
KnightOfOne 於 2 天前 * 發表
Hey everyone! So I spent yesterday trying to figure out how to convert a pdf file with flashcards into a deck on Anki. The majority of the information on the web is for individuals with coding experience or some level of a knowledge base in coding. Unfortunately, my knowledge base and understanding of coding was too minimal to use those sites and I had to learn. Therefore, I’m making this guide to help someone who might find themselves in my position.
Acknowledgements
So you have a pdf file you want to make into an Anki deck. You’ve combed through the web and stumbled upon Takenote but have no idea how to use it. That is the entire basis for this guide. Takenote I give all credit to Takenote’s creator and honestly thank them.
Pre-Guide Requirements
PDF file with flashcards with separate question and answer pages. Here's an example:
Page 1
Front 1 | Front 2 |
---|---|
Front 3 | Front 4 |
Page 2
Back 2 | Back 1 |
---|---|
Back 4 | Back 3 |
If possible, try to create a new pdf file with about 2 pages; so 1 set of the above mentioned pages. We'll use these to get the right height, widths, and top-left offset coordinates without running through your whole pdf. (This saves a lot of time and frustration).
You can still use this script if you have more then 4 cards per page.
Part 1. The Set-Up
1.1 Download a Linux based system
There isn’t a complete need for this since you can use the command prompt on Windows or Terminal on Mac OS. However, since you have little to no experience working with programming, I’d rather you not mess up your machine by incorrectly typing something. Also the exact commands I list will be for Linux, as the creator of Takenote primarily uses that.
Installing Linux Steps:
Download Virtual Box from VirtualBox and download the platform packages for whoever operating system you’re currently using.
Open and install the package.
Download Ubuntu Desktop from Ubuntu
Install Ubuntu under Virtual Box Photo Guide
Ubuntu should start up!
1.2 Downloading Required Programs
You’ll first see your username followed by @ubuntu:~$
2.1. Therefore, everything I type in quotes, Type after the above. Type the command lines exactly!
First we need to make sure we have all updated versions of software.
Type each line one by one and press enter after each line. If prompted [Y/N] Type Y and press enter.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install pdftk
sudo apt-get install imagemagick sudo apt-get install anki
Part 2. Finding out our measurements
Now we have all the software we need to run the script!
Now go back to the top-left card and this is mostly a guess and check issue. If you had to guess, how much space horizontally and vertically would you need from the top left corner to get the best top left card picture. You can use the crop tool again to get exact height and width measurements.
8.1. When we input this into pdf2anki will offset all of your cards on every page, so pdf2anki will delete that space when running. It'll take the top left card picture and use that as it's relative center.
Part 3. Manipulating Script
Wow, so now you've written down a few values and the prep work is done!
Go to line 12 and 14. And input the card width and height values.
w = ___
h = ___
Go to line 17 and 19. And input the following:
let col = 1
let row = 1
If you have more then 4 cards per page, this is where you change it. The idea is, that your going to have 2 separations if you have 1 column or row (n-1). Say you have twelve cards per page, in 3 columns and 4 rows. You would input col = 2, and row =3.
Go to line 39, 40, 41, 42. And input the card offset width and height values.
let floff=____ # front pages - X left top border offset
let ftoff=____ # front pages - Y left top border offset
let bloff=____ # back pages - X left top border offset
let btoff=____ # back pages - Y left top border offset
After inputting all the information, click save! Now on the bottom right of the page, there should be a little drop down menu that says .txt Click that and search for .sh Once selected, save pdf2anki again and close it.
Right click pdf2anki and click properties. Go to the advanced tab and click run as executable.
Part 4. Testing the Output
You should see picture files of those pages. Click on them and see if they look good.
Is all the information on the card?
Are the heights/widths good? If not, you'll have to back to Part 2. Finding out our measurements and find them again.
Do the front and back cards match? They should!
If everything looks good, you're pretty much done. Select all the files that came out (.png and 1 .txt) files and right click and select Move to Trash.
Part 5. Almost Done
This step is only necessary if your pdf file has its questions and answers pages alternated. This is the norm ... but the script doesn't account for that... This took me a while to figure out ... I didn't make a small pdf file like I had told you all to ...
Move newFile.pdf to the desktop (not necessary just makes it easier)
Part 6. Run IT
WE'RE DONE!!!!
Part 7. Input into Anki
Copy all of your .png files into this folder, collection.media
10.1 Specifically the ones with endings in the letter "f" or "b". You don't need to save the ones ending in only a number (those are just the image files of each individual pdf page that ImageMagick needed to make our flashcards).
Open Anki
Study to your heart's content!!
Aside
This took much longer to write then I expected it to. I've made it as detailed as possible so there shouldn't be many problems. Please read it throughly. I hope it's helpful.
status | not read | reprioritisations | ||
---|---|---|---|---|
last reprioritisation on | suggested re-reading day | |||
started reading on | finished reading on |