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).
On many Linux installations it is included in the default install, otherwise install with a package manger, for instance apt: sudo apt install poppler-utils.
On macOS it can be installed with the homebrew package manager: brew install poppler (untested as I don’t have access to a Mac).
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
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:
I have a pdf reader on my iPad called “documents by reddle”
I open pdf on iPad using it
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)
Open anki on my pc and have the original pdf and the pdf with hidden text
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)
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
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:
Go into the addon directory (From the Addon dialog → View Files)
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----------------')
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.
Edit:
I did inserted the command u mentioned.
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.
Hi Triaiou,
I got the same issue as ruban, who unfortunaly didn´t respond to your last massage.
After installing popplers Libary and checking every step twice with chatgpt i always get the Message from anki:
The following parts were not detected on the system:
pdfinfo
pdftohtml
pdftoppm
pdftotext
The poppler library cannot be included with the addon on this plattform. please install the poppler library through a package manager (with homebrew (brew.sh) “brew install poppler-utils” or equivalent) and ensure the above are in the path.
twice checked.
So i tested your method, to includ a code into the init.py file and after that i am getting an extra massage saying. Platform:Darwin that i couldn´t click away. so i undid that step and after so many hours i wanna find out what else i can do to use your Add on because its so cool.
May the reason be that i am using a Macbook. (correct version of anki installed)
after trying your way the second time - i undid it again because anki showed me the same error @ruban had. so this cant be the solution.
You were interested whats the outcome between the --------
Hi, ok thanks. Everything looks as it should so I don’t really understand what is not working. Could you you try a few things from the terminal (i.e. open a terminal window) and paste the output here?
pdftotext --version
which pdftotext
ls -al /usr/local/bin
ls -al /usr/local/Cellar/poppler/23.10.0/bin
Also, if you run Anki from the terminal, do you get the same error? I think you run Anki from the terminal on MacOS through open /Applications/Anki.app depending on how you installed it.
update:
i tried import a pdf converted from uptodate,
seems this time the sorting is working. thanks
hi, i made the following comment at the add on page:
the plugin do it’s job, however i am NOT using it as it grabbed the 1st line into the sort field by default.
personally i’ll prefer the image’s name e.g. book-abc-p001.png etc so that i can sort myself.
currently, the sort order is RANDOM, make it rather not useable to ME.
but if it changed, it may save you from export a PDF to *.png, import by mediaimport.
I forget did this addon can import into image occlusion note types?
thanks.
if i do the export->media import way,
“media import” addon allow choosing what become what when importing,
thus i could make the image name/page name into the sort field.
now the sort field is random, making it quite handicapped.
thanks