Pmt flashcards from jpgs into deck

I am new to Anki and have been garnering may resources for studying including Anki. I recently downloaded a pdf of all the pmt flashcards for different subjects and wanted to import them into anki as decks but I can’t figure out how to beyond converting the pdfs into jpgs (image 1 = front of card 1, image 2 = back of card 1 etc). I’ve tried looking for addons that could make importing this possible or at least more clear but I couldn’t find anything.

Any help would be appreciated. Thanks!

There are several PDF add-ons.
But I’ll use “Flashcards - Topic 4.2 Materials - AQA Physics A-level.pdf” as an example.

But it’s protected, so there are problems importing.
I do it more simply: go to the website Convert PDF to JPG. Extract images from a PDF
I upload the file and get an archive “ilovepdf_pages-to-jpg.zip” containing files like this:
Flashcards - Topic 4.2 Materials - AQA Physics A-level_page-0001.jpg
Flashcards - Topic 4.2 Materials - AQA Physics A-level_page-0002.jpg
Flashcards - Topic 4.2 Materials - AQA Physics A-level_page-0003.jpg

You can throw away the first file; it’s the name of the deck.
Flashcards - Topic 4.2 Materials - AQA Physics A-level_page-0001.jpg

Then you need to create something like this:
Flashcards - Topic 4.2 Materials - AQA Physics A-level_0001.jpg
Flashcards - Topic 4.2 Materials - AQA Physics A-level_0001_2.jpg
Flashcards - Topic 4.2 Materials - AQA Physics A-level_0002.jpg
Flashcards - Topic 4.2 Materials - AQA Physics A-level_0002_2.jpg

Doing it manually takes a long time, so the AI ​​writes a script:

import os
import re

folder = os.path.dirname(os.path.abspath(__file__))
os.chdir(folder)

files = sorted([f for f in os.listdir('.') if f.lower().endswith('.jpg')])

pattern = re.compile(r'_page-(\d+)\.jpg$', re.IGNORECASE)

renamed = 0
pair_num = 1

for i in range(0, len(files), 2):
    if i + 1 < len(files):
        # Pair of files
        first = files[i]
        second = files[i + 1]
        
        match1 = pattern.search(first)
        match2 = pattern.search(second)
        
        if match1 and match2:
            base_name = pattern.sub('', first)
            new_num = f"{pair_num:04d}"
            
            new_first = f"{base_name}_{new_num}.jpg"
            new_second = f"{base_name}_{new_num}_2.jpg"
            
            if not os.path.exists(new_first):
                os.rename(first, new_first)
                renamed += 1
                print(f"OK: {first} -> {new_first}")
            
            if not os.path.exists(new_second):
                os.rename(second, new_second)
                renamed += 1
                print(f"OK: {second} -> {new_second}")
            
            pair_num += 1
        else:
            print(f"SKIP: {first} or {second} doesn't match pattern")
    else:
        # Single file left
        print(f"SKIP: odd number of files, last file {files[i]} not processed")

print(f"\nDone! Processed {renamed} files in: {folder}")
input("\nPress Enter to exit...")

Place this script in the “rename_pages.py” file in the folder with these images. Run the script and check that everything is working correctly.

Then install the add-on https://ankiweb.net/shared/info/129299120

View the results in the “MediaImport” deck