A powerful Zotero plugin that automatically recognizes PDF content and generates bilingual notes
Current Version: v0.1.0 (Alpha) | Progress: 85% | Core Features Complete
✅ Completed:
- Complete OCR recognition system (PaddleOCR-VL integration)
- Bilingual translation services (DeepL + OpenAI)
- Action strategy pattern architecture
- Content processing pipeline
- Bilingual note generation
- Configuration management system
- UI components (menus, dialogs, progress bars)
- Cost estimation feature
- Batch processing support
- Complete preferences interface
🚧 In Progress:
- Unit and integration tests
- Error handling optimization
- Performance optimization and caching
📋 Planned:
- Multi-language translation support (Japanese, Korean, etc.)
- Custom template system
- Cloud configuration sync
- 🔍 Smart OCR Recognition - Uses Baidu PaddleOCR-VL to recognize PDF content, supports text, headings, formulas, tables, images, and more
- 🌐 Multi-Service Translation - Supports DeepL and OpenAI translation services with flexible switching
- 📝 Bilingual Notes - Automatically generates bilingual Markdown notes with original text + translation, preserving formatting
- 🧮 Formula Explanation - Uses LLM to explain mathematical formulas (optional)
- 💰 Cost Estimation - Displays estimated costs before processing to avoid unexpected expenses
- 📊 Batch Processing - Supports processing multiple PDF files at once
- ⚙️ Flexible Configuration - Rich configuration options to meet different needs
- 🌍 Multi-language Support - UI supports Chinese and English switching
Demo videos and screenshots coming soon
- Download the latest
.xpifile from Releases - Open Zotero → Tools → Add-ons
- Click the gear icon in the top right → Install Add-on From File
- Select the downloaded
.xpifile
# Clone the repository
git clone https://github.com/leauny/ZoteroTransinator.git
cd ZoteroTransinator
# Install dependencies
npm install
# Build the plugin
npm run build
# Find the generated .xpi file in the build directoryThe plugin uses Baidu PaddleOCR-VL service, API application required:
- Visit Baidu AI Cloud
- Enable the "Document Understanding" service
- Obtain API URL and Token
- Fill in the plugin settings
Example Configuration:
API URL: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/doc_convert
API Token: 24.xxx...
- Visit DeepL API
- Register and obtain API Key
- Select "DeepL" in plugin settings
- Fill in API Key
- Choose whether to use free API
Cost: Free version 500,000 characters/month, paid version $20/million characters
- Visit OpenAI or compatible API providers
- Obtain API Key
- Select "OpenAI" in plugin settings
- Fill in API Endpoint and Key
- Select model (e.g.,
gpt-4,gpt-3.5-turbo)
Cost: Billed per token, refer to provider pricing
- Translate Tables: Whether to translate table content (may incur higher costs)
- Explain Formulas: Use LLM to explain mathematical formula meanings (requires OpenAI)
- Skip Formulas: Skip formulas without processing
- Batch Size: Number of content blocks per batch (affects speed and stability)
- Timeout: API request timeout
- Max Concurrency: Number of simultaneous API requests
- Show Cost Estimate: Display estimated cost before processing
- Confirm Before Process: Show confirmation dialog
- Select a PDF attachment in Zotero library
- Right-click and select "Convert and Translate PDF"
- Review cost estimate (if enabled) and confirm
- Wait for processing to complete
- Generated bilingual note will automatically open in sidebar
- Hold Ctrl/Cmd and select multiple PDF attachments
- Right-click and select "Batch Convert and Translate"
- Confirm batch processing
- Monitor progress dialog
- Review statistics after completion
Example of generated note format:
# Introduction
> Introduction
This paper presents a novel approach...
> This paper presents a novel method...
## Background
_Background_
### Mathematical Formula
$$E = mc^2$$
> This is Einstein's mass-energy equation, expressing that energy equals mass times the speed of light squared...ZoteroTransnator/
├── OCR Service - PDF recognition service
├── Translation Service - Translation service (DeepL/OpenAI)
├── Action Pattern - Content processing strategies
│ ├── TranslateAction
│ ├── ExplainFormulaAction
│ └── KeepOriginalAction
├── Content Processor - Content processing coordinator
├── Note Generator - Note generator
└── UI Components - User interface
├── Context Menus
├── Progress Dialog
└── Cost Estimate Dialog
PDF File
↓
[OCR Recognition] → ContentBlock[]
↓
[Action Processing] → ProcessResult[]
↓
[Markdown Generation] → Bilingual Text
↓
[HTML Conversion] → Formatted Content
↓
[Create Note] → Zotero Note
- Node.js 16+
- npm 8+
- Zotero 7.x (recommended)
# Install dependencies
npm install
# Development mode (auto hot reload)
npm run start
# Build production version
npm run build
# Code check and formatting
npm run lint:check
npm run lint:fix
# Run tests
npm run test
# Release version
npm run releasesrc/
├── types/ # TypeScript type definitions
│ ├── content.d.ts # Content blocks and processing context
│ ├── action.d.ts # Action interfaces
│ ├── translation.d.ts # Translation service interfaces
│ └── ocr.d.ts # OCR types
├── utils/ # Utility functions
│ ├── apiClient.ts # HTTP client
│ ├── configManager.ts # Configuration manager
│ └── prefs.ts # Preferences
├── modules/ # Core modules
│ ├── actions/ # Action strategy implementations
│ │ ├── base.ts
│ │ ├── translateAction.ts
│ │ ├── explainFormulaAction.ts
│ │ └── keepOriginalAction.ts
│ ├── translationService/ # Translation services
│ │ ├── deeplService.ts
│ │ ├── openaiService.ts
│ │ └── index.ts (factory)
│ ├── ui/ # UI components
│ │ ├── dialogs.ts
│ │ └── menuItems.ts
│ ├── ocrService.ts # OCR service
│ ├── contentProcessor.ts # Content processor
│ ├── noteGenerator.ts # Note generator
│ └── pdfProcessor.ts # PDF processing main flow
└── hooks.ts # Plugin lifecycle hooks
addon/
├── content/ # XUL interface files
│ └── preferences.xhtml # Preferences interface
└── locale/ # Localization files
├── en-US/
└── zh-CN/
typings/ # Global type definitions
doc/ # Detailed documentation
Action Strategy Pattern:
ContentType → ActionFactory → IContentAction → ProcessResultService Abstraction Layer:
ITranslationService
├── DeepLTranslationService
└── OpenAITranslationServiceProcessing Flow:
PDF → OCR Recognition → Content Chunking → Action Processing → Note Generation → Zotero Storage
// 1. Create new Action class
export class MyCustomAction extends BaseAction {
async process(
block: ContentBlock,
context: ProcessContext,
): Promise<ProcessResult> {
// Implement processing logic
return {
success: true,
processed: "Processed content",
format: "quote",
cost: 0,
};
}
}
// 2. Register in src/modules/actions/index.ts
export function registerDefaultActions(): void {
factory.registerAction("custom-type", MyCustomAction);
}// 1. Implement ITranslationService interface
export class MyTranslationService implements ITranslationService {
async translate(
texts: string[],
options: TranslationOptions,
): Promise<string[]> {
// Implement translation logic
}
async estimateCost(textCount: number, charCount: number): Promise<number> {
// Implement cost estimation
}
async testConnection(): Promise<boolean> {
// Implement connection test
}
}
// 2. Register in factory
TranslationServiceFactory.createService("my-service", config);- OCR Recognition: ~2-5 seconds/page (depends on content complexity)
- Translation: ~1-3 seconds/batch (10 text blocks)
- Note Generation: <1 second
Example: A 10-page English paper
| Item | Quantity | Cost (DeepL) |
|---|---|---|
| OCR | 10 pages | Free (API provider pricing) |
| Translation | ~5000 characters | $0.10 |
| Total | - | ~$0.10 |
Solutions:
- Check if plugin is correctly installed and enabled
- Restart Zotero
- Check error console (Tools → Developer → Error Console)
Possible Causes:
- API URL or Token incorrect
- PDF file corrupted or encrypted
- Network connection issues
Solutions:
- Verify API configuration
- Test API connection
- Check if PDF file opens normally
Possible Causes:
- Invalid or expired API Key
- Quota limit exceeded
- Text too long
Solutions:
- Verify API Key
- Check account balance/quota
- Reduce batch size
Contributions of code, issue reports, or suggestions are welcome!
- Fork this repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
- Follow TypeScript best practices
- Add appropriate comments and documentation
- Ensure code passes ESLint checks
- Maintain consistent code style (use Prettier)
- Add test cases for new features
- OCR recognition system
- Bilingual translation services (DeepL + OpenAI)
- Basic Action strategies
- Configuration management
- UI components and menus
- Batch processing
- Cost estimation
- Complete unit test coverage
- Integration test framework
- Enhanced error handling
- Detailed error messages
- Optimized auto-retry mechanism
- Failure recovery strategies
- Performance optimization
- Caching mechanism (translation result cache)
- Optimized concurrency control
- Improved memory management
- Logging system
- Structured logging
- Log level control
- Export log files
- Multi-language Support
- Japanese, Korean, French, German, etc.
- Automatic language detection
- Multi-target language translation
- Advanced Content Processing
- Code block recognition and syntax highlighting
- Citation link processing
- Footnote and reference handling
- Image OCR (text in images)
- Note Enhancement
- Custom note templates
- Export to multiple formats (PDF, Word, HTML)
- Note tags and categorization
- More Translation Services
- Google Translate API
- Azure Translator
- Other LLMs (Claude, Gemini)
- Cloud Features
- Cloud configuration sync
- Translation history
- Glossary management
- Team Collaboration
- Shared glossaries
- Translation template sharing
- Annotation and commenting features
- API and Integration
- REST API interface
- Webhook support
- Integration with other tools (Notion, Obsidian)
- Complete documentation and tutorials
- Video demos and user guides
- Multi-platform testing (Windows, macOS, Linux)
- Performance benchmarks
- User feedback collection and improvements
- Official release and promotion
- AI Enhancement
- Intelligent summary generation
- Keyword extraction
- Topic classification
- Related literature recommendations
- Advanced Analytics
- Literature analysis tools
- Statistics and visualization
- Trend analysis
- Mobile Support
- iOS app
- Android app
- Mobile note sync
- 🎉 Initial release
- ✨ OCR recognition feature
- ✨ Bilingual translation (DeepL + OpenAI)
- ✨ Batch processing support
- ✨ Configuration management system
- ✨ UI components and dialogs
- ✨ Cost estimation feature
- Large PDF files (>100 pages) may timeout
- DeepL free API limitation handling
- Complex table recognition accuracy needs improvement
- Formula explanations occasionally imprecise
- Batch processing progress update delay
- Preferences interface UI optimization
- Error messages need to be more user-friendly
A: All standard PDF files are supported, including scanned and text-based versions. Scanned versions require OCR recognition.
A: Typically 2-5 seconds per page, depending on content complexity and network speed.
A:
- DeepL: Charged by character count, free version 500,000 characters/month
- OpenAI: Charged by token, refer to model pricing
A: Currently requires network connection to call OCR and translation APIs. Offline mode may be added in the future.
A: Generated notes can be manually edited for corrections. It's recommended to enable "Confirm Before Process" option in settings.
A: Currently mainly supports English to Chinese translation. Other language support will be added in v0.3.0.
- Zotero - Excellent reference management tool
- Baidu PaddleOCR-VL - Powerful OCR service
- DeepL - High-quality translation service
- OpenAI - LLM technology
- Zotero Plugin Template - Plugin development template
This project is licensed under AGPL-3.0.
If this project helps you, please give it a ⭐️ Star!
Welcome to submit Issues and Pull Requests!