8 ms·
I had to solve this problem a few years ago. My solution was as follows: 1. Convert PDF -> multiple individual SVG files. (I probably used Cairo) 2. Use Inksc
by luminadiffusion 6y ago
I had to solve this problem a few years ago. My solution was as follows:
1. Convert PDF -> multiple individual SVG files. (I probably used Cairo)
2. Use Inkscape to set your fields and name them like Django template variables.
3. Store these prepared SVGs in the file system of your app.
4. Call them when needed and fill them in with the Django Template rendering engine.
4a. Works with including images too if you convert them to base64 encoded PNG, then insert them into the SVG.
5. Convert individual SVGs -> individual PDFs. (Cairo)
6. Merge individual PDFs into a single combined PDF. (Cairo)
7. Deliver finished merged PDF.
After the initial step of preparing your SVG, which can take a bit of time to get right, it only takes about 2-3s to produce a fully compiled PDF and gives you all of the necessary functionality out of them - sans all of these chaotic intervening libraries.
I can't tell you how many months it took me to figure that out. It was a while though. When the system was operational, we were sending 10,000 multipage PDFs per day on a single Django instance on a T2 medium AWS instance.