Download PDFs from Zotero by citation key, cut non-educational end-matter, and prepare for Swanki.
When the user asks to import papers from Zotero, follow this workflow:
The user provides one or more citation keys as arguments, e.g.:
/zotero-paper-import montanolopezPhysiologicalLimitationsOpportunities2022/zotero-paper-import key1 key2 key3/Users/michaelvolk/miniconda3/bin/python scripts/zotero_paper_import.py <key1> [key2 ...]
This single command handles everything per key:
../Swanki_Data/{key}/qpdf, creates _clean.pdf via pdfunite.sh runner scriptUse --download-only to skip the cleaning step if needed.
If end-matter is NOT auto-detected for a paper (script reports "No end-matter heading detected, keeping all pages"), or if the auto-detected ranges look wrong (e.g. SI figures were cut), manually inspect the PDF pages and re-cut using qpdf + pdfunite:
# Example: keep pages 1-12 and 15-30, cutting refs (13-14) and reporting summary (31-33)
qpdf input.pdf --pages . 1-12 -- range0.pdf
qpdf input.pdf --pages . 15-30 -- range1.pdf
pdfunite range0.pdf range1.pdf output_clean.pdf
rm range0.pdf range1.pdf
After all keys are processed, report: