PDF to notes [Support thread]

Using the poppler library (https://poppler.freedesktop.org/) the add-on converts a PDF file into notes.

  • Question/prompt extracted from each page (the first line of text)
  • Convert PDF pages to separate “normal” (front/back) notes or separate clozes in a single cloze type note.
  • PDF pages inserted as images or HTML (using poppler pdftoppm and pdftohtml).




  • Deck: Which deck the added note(s) will be inserted into
  • Note type: Which note type to use for insertion, supports “normal” (front/back) note types as well as cloze note types.
  • Front (“normal” (front/back) note type): Which field to insert the “question” (first line of text in the page) in.
  • Back (“normal” (front/back) note type): Which field to insert the “answer” in.
  • Title field (cloze note type): Which field to insert PDF file name as title (for note types, such as the built-in cloze, that do not have a suitable field for this, select <none>).
  • Cloze field (cloze note type): Which field to insert clozes into. Clozes are inserted as prompt: {{c1::<br>answer}}<br> where prompt is the first line of text extracted from the page and answer is either an image of the page or a <div> with the page HTML.
  • Format: Format to insert the pages in, either as images (will preserve exact layout and work well on all screen sizes but no editable/selectable text) or HTML (does not give perfect results on any screen, especially not small screens but text can be copied/edited).


1 Like

On linux I got
[Errno 2] No such file or directory: ‘/tmp/tmp5hp11s3m/pgtxt.txt’

Ok, could you run Anki from bash and see what you get from stderr? pgtxt.txt is the temp file that subprocess.run([PDFTOTXT, "-layout", pdf, tmp_file], stdout=subprocess.PIPE, universal_newlines=True, shell=True) is supposed to write to so I am guessing that fails for some reason. You are certain you have pdftotext installed an in the path?

This addon is very good, but please make a feature where you can make one page of the pdf the front and one page the back or even one pdf be all the front and one pdf all the back, this would be very useful for making occlusion cards using pdf

I am not sure I understand, do you mean something like this?

  • Page 1 and 2 make front and back of one note
  • Page 3 and 4 make front and back of a second note
  • Etc

When you say “occlusion cards”, do you mean image occlusions? Or something else?

sorry for not being clear:
using image occlusion add-on takes too long for me to make the cards that I want;

what I do is take the professors pdf slides convert them to images and hide the important parts, keywords, definitions, etc…

But when I use image occlusion add-on it takes a very long time to hide all the text I need hide(I have to do about 400 slides for 8 subjects each semester), so what I want to be able to do is the following:

  1. I have a pdf reader on my iPad called “documents by reddle”
  2. I open pdf on iPad using it
  3. highlight in black the text I want to hide (using iPad would be 10x faster then using image occlusion add-on to hide the text)
  4. Open anki on my pc and have the original pdf and the pdf with hidden text
  5. add the pdf to your addon and the addon makes them into flashcards( the details are below)

idea/ feature 1:
one PDF: page 1 front page 2 back, page 3 front page 4 back (like you said)

idea/ feature 2:

pdf1 on the right pdf2 on the left
two PDFs:
Card #1
(pdf1 page 1) front
(pdf2 page 1) back
Card #2
(pdf1 page 2) front
(pdf2 page 2) back

(meaning that all the front of all the cards will be from pdf1 and all the back of the cards will be from pdf2)

I have one pdf that is normal and a second pdf that I have covered some text from, I want to be able to use one pdf as the front part of the cards and one as the back part of the cards, (idea 1)

or I have a way to merge these pdfs in an alternating fashion (its an online tool) (I have page 1 pdf 1 and then page 1 pdf 2, page 2 pdf 1 page 2 pdf 2) so i can just use one pdf even number being front and odd number the back (idea 2)

I will screen shot of a merged pdf for you to see what i mean for idea 1 if you didn’t understand it

it would be best to make both the ideas so people can use idea 1 or 2 depending on there situation

Ok, I understand, I can maybe have a look at it when I have some spare time (a few other things are ahead in the pipe line).

Seeking Assistance with PDF to notes: unclear why Anki is still unable to detect popplear(installed with homebrew)

I installed homebrew and popplear from the homebrew. Then I entered the code for the add-on and restarted Anki. But it showed an error message.

So I reinstalled popplear library and I checked that the necessary components are in the correct location by running a command “pdftotext -v” as this command checks if the pdftotext utility from the Poppler library is accessible from the command line.

Based on the terminal output it appears that the Poppler library was successfully reinstalled using Homebrew. The output indicates that the Poppler version 23.08.0 was downloaded and poured into the appropriate location. But still anki keep on showing the same error. I am using the latest version of anki. I kindly request your guidance and support in resolving these issues. Any insights, suggestions, or fixes you can provide would be greatly appreciated.

Hmm, I don’t have a mac to test on, could it be that the poppler files are not in the path that is used by Anki? Or that sys.platform doesn’t return darwin? Do you have any familiarity with any programming languages? If so, you could:

  1. Go into the addon directory (From the Addon dialog → View Files)
  2. Edit __init__.py:
    a. Insert a new line at line 351 (the line after if not (sys.platform == 'win32' or sys.platform == 'cygwin'):)
    b. Enter the following on the inserted line: print(f'----------------------\n{sys.platform}\n{os.environ}\n----------------')
  3. Run anki from the console - this way you will see what is printed and I would be interested on seeing the output between the two ----------------------- (edit any sensitive info before posting)

I’m not familiar with what you said. Even the I did the of Homebrew and poppler installation with the help of Chat gpt. I’ll try doing this with the help of chat gpt again.
I did inserted the command u mentioned.

But I couldn’t Run Anki from the console. Don’t know how to do it.

i dunno if it’s right i tried to run anki from the console

When i opened Anki after inserting the line you mentioned it showed me some kind of error.

Yes, Python is a whitespace sensitive language, you need to indent the inserted line to the same level as the next line, i.e. so it looks like this:

To run from the command line, try opening a terminal (untested as I don’t have a Mac):

  • cd /Applications/Anki.app/Contents/MacOS/
  • ./Anki

Then you should see some stuff printed to the terminal, among that info, look for the stuff between the ------------------------

If you are unable to get Anki running from the command line we can try this instead, at the same place in the same file insert
show_info(f'platform: {sys.platform}')
show_info(f'env: {os.environ}')

So that it looks like this:


That will show the same info but in two dialogs instead.