Reputation: 140
I need to generate around 100,000 bills every quarter. Currently I have a template SVG file in which I find & replace text in PHP to produce a new file. This gives me desired result but I have to send these files for printing too, in PDF format. So after conversion to SVG I have to convert all files to PDF again & then merge them into PDFs having 1000 pages each, using pdftk.
Ideal scenario would be to generate PDFs directly by text search & replacement in one template pdf file (to avoid overhead of creating each file from scratch) but I have no idea how to do that, as the text in PDF is encoded & I also can't find a way to create a PDF without font-embedding, it unnecessarily increases filesize.
Alternately, if I could directly join SVGs to one big PDF file (combination of 1000 SVGs) without first converting each one of them to PDF, that'd work too.
Please keep in mind that all text fields are aligned according to their respective position on bill format. So all conversions/merging should be exact & text should not move.
All operations are taking place in a headless linux server, so CLI please.
Kindly help.
Upvotes: 2
Views: 2233
Reputation: 4262
Based on your exact needed features for this volume (I assume it is a volume of 100,000 in one go in each quarter) I recommend using a report writer tool. That can be done using tools delivered with your development environment such as Oracle Developer or additional tools.
I most often use JasperReports / iReports which is a free product for volumes exceeding 10K pages per go. Runs on Servlet engine or separate using 'java' from commandline. Generating 10K or more pages within Word is too cumbersome even with additional add-ins. Being a page description tool, locations do not move and you can include barcodes or instructions for payment in special fonts too. We use the LGPL edition of iReports for our project management software, for reports example see http://www.invantive.com/en/demo/web/bubs_pjt_all.html and then click Administration -> Audit for an output sample. In our software we have added some classes to make it run better and also needed to add a scheduler to repeatedly generate output such as invoices and distribute them. It does not include a scheduler by itself.
It also supports other output formats such as Excel, PowerPoint, XML, OpenOffice and others. You can add more rendering options yourself. It can be fed from most relational data sources as well as various object-oriented formats.
Runtime varies, but 10-100 pages per second is feasible when correctly designed.
Replacing in a PDF is I think a bad plan; PDF was not designed with editing in mind. Even though it is possible. When you want to do replacing in the printing format, you can also consider using PostScript and a script to replace placeholders.
Upvotes: 0
Reputation: 101868
SVG is a single page document format. So there would be no way to create a multipage SVG that could be converted to a multipage PDF. If that is what you meant.
What you are trying to do is commonly known as a "mail merge". If you google "mail merge PDF" you get plenty of possible solutions. The best one for you will depend on your OS and database.
Upvotes: 0