feat: Add inline image support to document templates#1
Merged
christoph2806 merged 2 commits intomasterfrom Aug 2, 2025
Merged
Conversation
- Add new endpoint /api/v1/process-template-document-with-images - Support Base64 encoded PNG images with flexible sizing (mm/px) - Implement comprehensive image processing with error handling - Add Pydantic models for structured image data validation - Maintain backward compatibility with original endpoint - Add comprehensive documentation in docs/image-support.md - Include React integration examples and best practices - Add test script with automated validation of image functionality - Update all documentation links and navigation - Clean up old test files and improve test organization This implementation leverages docxtpl's InlineImage capabilities and provides the most React-friendly API using Base64 encoding within JSON payloads for seamless frontend integration.
- Add image endpoint documentation to usage guide - Include image template syntax and examples - Update API examples in index.md to show both endpoints - Add Node.js and Python examples with images to integration guide - Ensure all documentation references both original and image-enhanced endpoints - Maintain comprehensive coverage of new image capabilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🖼️ Image Support Implementation
This PR adds comprehensive inline image support to the Document Template Processing Service, enabling embedding of PNG images directly in Word document templates.
✨ Key Features
{{ company_logo }}🚀 Implementation Highlights
📋 API Example
{ "template_data": { "customer_name": "John Doe", "logo": "{{company_logo}}" }, "images": { "company_logo": { "data": "base64_encoded_png_data", "width_mm": 50, "height_mm": 20 } } }📚 Documentation Added
✅ Testing
🔧 Files Changed
main.py- Core image processing implementationdocs/image-support.md- New comprehensive documentationtest_image_support.py- Automated test suiterequirements-test.txt- Added Pillow for testingREADME.md,docs/README.md,index.mdReady for review and testing! 🚀