tl;dr I'm looking for a good way of batch printing database-stored HTML documents from javascript
Our users generate rich text content via an open source WYSIWYG javascript-based text editor (CKEditor). The HTML content is saved to our database and can be printed directly from the editor via its inbuilt print functionality (basically just window.print()) . This is great and works perfectly.
Now, we have a need to batch print saved documents and I am looking for workable solutions. There are various options that I can see, but all have large tradeoffs:
User selects documents to print. JS code loops through documents and calls print one-by-one. The issue here is that the user will see a bunch of print dialogs. Which is painful. (Aside: we are using Chrome but I do not have the option of setting it to kiosk mode)
User selects documents to print. JS code combines all of these in a single (hidden) container and they are all printed as one 'document'. These can be fairly big documents with tables, images, etc. I worry about the performance involved here as we could be adding a significant amount to the DOM.
Similar to #2 above, but at some point the documents are converted and saved to a single PDF. This would be OK, but there don't seem to be many good/cost-effective options for converting HTML to PDF.
Generate some kind of a report that can handle HTML content. I took a look at SQL Server reporting services but it supports a very limited set of HTML tags and CSS properties.
Is there a better way to batch print HTML content from javascript? Any help is very much appreciated!
Edit As per @Paul, I need to clarify a few points:
The content is that which is created in your standard online text editor. In my case:
Now, were I to print straight from the editor a print stylesheet would be applied, so this may complicate things a bit.
Since content could be potentially large and consume a lot of memory I would do this on server side. Select docs on client and request server to render those to PDFs e.g. utilising PhantomJS. This would then allow you to even use mobile clients to fetch PDFs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With