A feature-rich Android drawing and notebook application with on-device AI handwriting recognition powered by Google Gemma.
Penpal transforms your device into a smart digital notebook with the following capabilities:
- Handwriting Recognition: On-device OCR using Gemma 4 E2B model via LiteRT-LM
- Local & Remote Inference: Support for both local Gemma inference and remote server-based inference
- Multi-page Notebooks: Create notebooks with unlimited pages that scroll vertically
- Whiteboard Mode: Infinite canvas for brainstorming and sketching
- PDF Import: Import PDF documents and annotate them
- Lasso Selection: Select and manipulate groups of drawn elements
- Search: Full-text search across all notebook pages including digital text from PDFs
- Export: Export drawings to PDF, SVG, or PNG formats
- Text Boxes: Insert explicit text elements anywhere on the canvas
- Audio Processing: Audio recording and playback for evaluation sessions
The app features a dark-themed UI with:
- Floating toolbar for drawing tools
- AI recognition status panel
- Page navigation and overview
- Color picker with custom HSV support
- Search functionality across all pages
| Component | Version |
|---|---|
| AGP | 9.1.1 |
| Kotlin | 2.2.10 |
| Compile SDK | 34 |
| Min SDK | 24 |
| Target SDK | 34 |
- com.google.ai.edge.litertlm:litertlm-android - On-device LLM inference (Gemma)
- com.tom-roush:pdfbox-android:2.0.27.0 - PDF text extraction
- org.jetbrains.kotlinx:kotlinx-coroutines - Asynchronous programming
- com.google.code.gson:gson - JSON serialization
- Android Studio Hedgehog (2024.1.1) or later
- Android SDK 34
- Kotlin 2.2.10
- Clone the repository:
git clone https://github.com/your-username/penpal.git
cd penpal-
Open in Android Studio
-
Sync Gradle files
-
Build and run on device or emulator
On first launch, the app will prompt you to download the Gemma model (~2.6 GB). The model is hosted on HuggingFace and requires a token for download.
Alternatively, download from Kaggle with API credentials.
- Launch the app to see the notebook selection screen
- Tap the + button to create a new notebook
- Choose notebook type (Notebook with pages or Whiteboard)
- Select a color for the notebook
- Configure default background (Ruled, Graph, or None)
- Select: Single item selection and editing (default tool)
- Brush: Free-form drawing with adjustable size and color
- Eraser: Remove strokes
- Lasso: Select multiple items for manipulation
- Text: Insert text boxes
- Draw text on the canvas
- The AI automatically analyzes strokes after a 2-second pause
- Recognized text appears overlaid on the strokes
- Tap the T button to toggle between stroke view and text view
- Use the Lasso tool to draw a selection around items
- Selected items can be:
- Moved: Drag to reposition
- Resized: Use the bottom-right handle
- Rotated: Use the top rotation handle
- Deleted: Tap the red X button
- Grouped: Lasso selects multiple items together
- Scroll vertically in notebook mode to navigate pages
- New pages are created automatically when scrolling past the last page
- Tap the Overview button to see all pages as thumbnails
- Delete pages from the overview dialog
- Tap the Import PDF button (floating action button)
- Select a PDF file from your device
- Choose which pages to import
- The PDF pages are converted to locked image items
- In drawing mode, tap the Add PDF button
- Select a PDF file
- Use the selection tool to crop a region
- The cropped region is inserted as an image with extracted text
- Tap the Export button
- Choose format: PDF, SVG, or PNG
- Select save location via system file picker
- Tap the Search button
- Type your query
- Results highlight matching items across all pages
- Navigate between matches with prev/next buttons
Draw a star (*) anywhere in your notes as a quick navigation marker. Tap the marker button to jump between marked locations.
See ARCHITECTURE.md for detailed system design documentation.
app_data/
└── files/
└── notebooks/
├── My Notebook_page_0.svg
├── My Notebook_page_0_thumb.png
├── My Notebook_page_1.svg
├── My Notebook_page_1_thumb.png
└── ...
- SVG files contain all drawing data (strokes, images, text)
- PNG thumbnails are generated for the overview screen
- Thumbnails are auto-generated during autosave
The Gemma model is stored in the app's external files directory:
Android/data/com.drawapp/files/gemma-4-E2B-it.litertlm
NotebookPrefs: Notebook list and settingspenpal_prefs: Model path and download state
If the app shows "Model not found", ensure you:
- Accepted the Gemma license on HuggingFace or Kaggle
- Have a stable internet connection
- Have sufficient storage space (~3 GB)
- Check that the Gemma model is loaded (look for green AI icon)
- Ensure strokes are clear and not too small
- Try drawing larger, more distinct characters
- Clear app data and restart
- Ensure sufficient memory is available
- Check for corrupted notebook files in the file manager
See DEVELOPMENT.md for development guidelines.
This project is for educational and personal use. The Gemma model is subject to Google's terms of service.
- Google Gemma: On-device AI model
- Tom Roush: PDFBox-Android library
- Android Open Source Project: Material Design components