Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



× body >.content .link .rank, .rank-spacer { width: 1.1ex } body >.content .link .midcol, .midcol-spacer { width: 3.1ex } .adsense-wrap { background-color: #eff7ff; font-size: 18px; padding-left: 4.2ex; padding-right: 5px; }

8 9 10

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

  1. PDF file with flashcards with separate question and answer pages. Here's an example:

    Page 1

    Front 1Front 2
    Front 3Front 4

    Page 2

    Back 2Back 1
    Back 4Back 3
  2. 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).

  3. 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:

  1. Download Virtual Box from VirtualBox and download the platform packages for whoever operating system you’re currently using.

  2. Open and install the package.

  3. Download Ubuntu Desktop from Ubuntu

  4. Install Ubuntu under Virtual Box Photo Guide

    1. Open Virtualbox
    2. Click New (located top left)
    3. Click Next
    4. Set name something like Ubuntu
    5. Set memory f.e. 1024 MB
    6. Select Create new hard disk
    7. Select VDI then Next
    8. Select Dynamically allocated then Next
    9. Set location(let it stay its default) and its size (f.e 20GB) then Next
    10. Then Create
    11. Then again Create
    12. Start VM
    13. Then install from .iso — This is what we downloaded from Ubuntu!
  5. Ubuntu should start up!

1.2 Downloading Required Programs

  1. On the desktop right-click and click “Open Terminal”
  2. 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!

  3. 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!

  1. Right click on the desktop and click Open Text Editor
  2. Copy the script from TakeNote and paste it into the text editor file
  3. Save as pdf2anki --- you don't need to do this, however it'll be easier to follow along if you do.
  4. Now here's where we need the small pdf file of flashcards. Right click the file and select Open with ImageMagick.
  5. In ImageMagick, left click on Transform and then Crop.
  6. Take your mouse and drag it around the top left card and write down the height and width values.
  7. Do the same for the other three cards and see if the same height and width values work for them. They should!
  8. 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!

  1. Open up pdf2anki
  2. Go to line 12 and 14. And input the card width and height values.

    w = ___

    h = ___

  3. 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.

  4. 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

  5. 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.

  6. Right click pdf2anki and click properties. Go to the advanced tab and click run as executable.

Part 4. Testing the Output

  1. Right click on the Desktop. Select Open Terminal
  2. Drag pdf2anki onto the command line (line we used to write stuff on)
  3. Drag PDF file SMALL version (the smaller pdf we had created.
  4. Type a "prefix" - literally anything you want. Since this is to test if we got all our numbers right we'll use test
  5. Hit Enter on your keyboard! Let the program run. Once it's done, we'll go check the output.
  6. Click on MyFiles and click the Home tab.
  7. 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!

  8. 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 ...

  1. Right click on the Desktop. Select Open Terminal
  2. Type pdftk
  3. Drag PDF file REAL version (the pdf we want to make flashcards out of)
  4. Type cat Aodd output odd.pdf
  5. Hit Enter
  6. Type pdftk
  7. Drag PDF file REAL version (the pdf we want to make flashcards out of)
  8. Type cat Aeven output even.pdf
  9. Hit Enter
  10. Type pdftk
  11. Drag Odd.pdf
  12. Drag Even.pdf
  13. Type cat output newFile.pdf
  14. Press Enter
  15. Delete odd.pdf and even.pdf
  16. Move newFile.pdf to the desktop (not necessary just makes it easier)

Part 6. Run IT

  1. Right click on the Desktop. Select Open Terminal
  2. Drag pdf2anki onto the command line (line we used to write stuff on)
  3. Drag newFile.pdf
  4. Type a "prefix" - literally anything you want.
  5. Hit Enter on your keyboard! Let the program run. Once it's done, we'll go check the output.
  6. Click on MyFiles and click the Home tab.
  7. You should see picture files of those pages.
  8. WE'RE DONE!!!!

Part 7. Input into Anki

  1. Start Anki and create a new empty deck
  2. Select File then Import
  3. Find the .txt file that pdf2anki also created in the Home folder
  4. Click it and then select Text separated by tabs or semicolons as type and check Allow HTML in fields. Now press Okay
  5. Create the deck but DO NOT study it
  6. Select Anki (MAC) or Tools (PC & Linux) then Preferences and click the Backups tab
  7. Click Open Backups Folder
  8. There should be two folders. Click on the collection.media folder
  9. Close the Anki Application
  10. 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).

  11. Open Anki

  12. 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.

If you want to change selection, open document below and click on "Move attachment"


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.