yimnai_devY
Convex Community4w ago
1 reply
yimnai_dev

Image Heavy PDF Generation

Context:
I’m building a React Native mobile app where users photograph handwritten medical records (e.g. in regions where healthcare isn’t digitized). We use AI to extract structured data, but we also need to export records as PDFs, upon request by users that embed the original images, because OCR/handwriting recognition is not 100% reliable.

Current setup:
• Images are stored via Convex file storage
• PDF generation uses React-PDF Renderer, which requires a Node or browser environment
• The app is React Native, so PDFs cannot be generated client-side
• PDF exports may include 10–40 images in a single document

Problem:
To generate a PDF, all images must be fetched and converted to base64 before rendering.
Doing this through Convex Actions (Use Node directive) means:
• Serverless cold starts
• Memory/time limits
• Longer generation times for image-heavy exports
• Poor UX for users on slow mobile networks (e.g. 3G/4G in parts of Africa)

I’m not trying to let clients download individual images but the issue is assembling many images into a single PDF efficiently.

Question:
From a Convex best-practices perspective, is it reasonable to:
• Use Convex for auth, metadata, and job orchestration
• Offload PDF generation to a dedicated service like Go or Node that fetches images via signed URLs, generates the PDF server-side, stores it, and returns a download URL?

Or is there a Convex-native pattern for handling image-heavy, long-running document generation that I may be missing?

I’d especially appreciate guidance on:
• Whether Convex Actions are intended for this kind of workload
• How others handle large server-side exports with many files
• Any pitfalls around fetching many Convex-stored files from an external worker

Thanks a bunch in advance for your help🙏
Was this page helpful?