Overview
This guide will help you integrate Sabrina's 10 Key adding machine calculator directly into your PDF.js viewer, allowing you to perform calculations while reviewing PDF documents.
Prerequisites
- PDF.js viewer (version 2.0 or higher)
- Basic knowledge of HTML/JavaScript
- Access to your PDF.js installation directory
Installation Steps
Step 1: Download Integration Files
- Download the PDF.js integration package from the website
- Extract the files to a temporary directory
- You should have the following files:
sabrina-tenkey-integration.js
- Main integration scriptpopup.html
- Calculator interface with embedded logicmanifest.json
- Configuration file
Step 2: Copy Files to PDF.js Directory
Copy the following files to your PDF.js web directory:
Step 3: Modify viewer.html
Add the integration script to your viewer.html
file. Insert this line before the closing </body>
tag:
Step 4: Configure Integration (Optional)
You can customize the integration by modifying the initialization in viewer.html
:
Usage Instructions
Opening the Calculator
- Keyboard Shortcut: Press
Alt+T
(or your configured shortcut) - Manual: Call
window.sabrinas10Key.toggle()
from the console
Calculator Features in PDF.js
- Floating Panel: The calculator appears as a floating panel that can be dragged anywhere on screen
- Always on Top: Calculator stays above the PDF content
- Resizable: Drag edges to resize (if enabled)
- Auto-Hide: Automatically hides when not in use
Keyboard Shortcuts
While the calculator is open:
Enter
orNumpad +
: AdditionNumpad -
: SubtractionNumpad *
: SubtotalNumpad /
: DivisionESC
: Clear allDelete
: Clear entryCtrl+C
: Copy tape
Advanced Integration
Copying Results to PDF Annotations
To enable copying calculator results directly to PDF annotations:
Persistent Tape History
To save calculator tape between sessions:
Troubleshooting
Calculator Doesn't Appear
- Check browser console for errors
- Verify all files are in correct directories
- Ensure popup.html path is correct in the integration script
- Check if popup blockers are interfering
Keyboard Shortcuts Not Working
- Ensure PDF viewer has focus
- Check for conflicts with PDF.js shortcuts
- Try different shortcut combinations
Calculator Loads But Doesn't Function
- Verify popup.html loaded correctly with embedded JavaScript
- Check for JavaScript errors in console
- Ensure no Content Security Policy violations
Browser Compatibility
- Chrome/Edge: Full support
- Firefox: Full support
- Safari: Limited drag functionality
- Mobile: Touch support varies
Security Considerations
- The calculator runs in an iframe for isolation
- No external connections required
- All calculations performed locally
- No data is sent to external servers
Customization Options
Styling
Modify the container styles in sabrina-tenkey-integration.js
:
Adding Custom Buttons
Extend the title bar with custom actions: