Export data to PDF / DOCX

46 views
Skip to first unread message

Deep SiderZ

unread,
May 4, 2017, 9:53:23 PM5/4/17
to nodejs
Hi everyone,

I'm trying to export data to PDF / DOCX files. At present I use a HTML/CSS template that I fill with my data with ejs package. Then when this template is ready I use Libre Office (with soffice command in headless mode) to export it to PDF or DOCX format. It works but the result is ugly ...
I would like to be able to have a beautiful result. I want to put pictures, tables, colorized texts in the output format.

Do you have an idea on how to achieve this ? It can be a library (one for PDF and one for DOCX or better, juste one for both) or a program that I can exec from my nodejs app. Or it can also be a solution in another language than javascript.

Thank you for your help !

Matt

unread,
May 6, 2017, 6:32:08 PM5/6/17
to nod...@googlegroups.com
Try using node-phantom-simple (or one of the drivers, like slimerjs). It will look exactly like it would in a browser, even supporting SVG graphs. For images you can even generate data: URLs so you only need to load a single HTML file.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/feedc87b-427a-4807-bb31-fe78809f10db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Boris Matos Morillo

unread,
May 6, 2017, 6:32:08 PM5/6/17
to nodejs
you should try https://github.com/jsreport/jsreport , which you can easily consume from your node js app 🙂

Witold Szczerba

unread,
May 7, 2017, 10:47:28 PM5/7/17
to nod...@googlegroups.com
P.S. When I said creating the templates in DOCX, I meant using the LibreOffice. Since it is going to be used to render, you will see exactly how it is going to look like.  As a bonus, non technical stuff can create and maintain these templates.

07.05.2017 11:47 "Witold Szczerba" <witold...@gmail.com> napisał(a):
I would try to create these templates in. DOCX instead of HTML. That would give you much better control. The DOCX format is just a ZIP file with XML inside, so manipulating the content should not be a huge problem. 

--

Witold Szczerba

unread,
May 7, 2017, 10:47:36 PM5/7/17
to nod...@googlegroups.com
I would try to create these templates in. DOCX instead of HTML. That would give you much better control. The DOCX format is just a ZIP file with XML inside, so manipulating the content should not be a huge problem. 
05.05.2017 03:53 "Deep SiderZ" <alexis...@gmail.com> napisał(a):
--

Matt

unread,
May 9, 2017, 9:31:18 PM5/9/17
to nod...@googlegroups.com

On Sun, May 7, 2017 at 5:51 AM, Witold Szczerba <witold...@gmail.com> wrote:
P.S. When I said creating the templates in DOCX, I meant using the LibreOffice. Since it is going to be used to render, you will see exactly how it is going to look like.  As a bonus, non technical stuff can create and maintain these templates.

Interestingly I actually wrote about doing this sort of thing 16 years ago (when it was called OpenOffice) here: http://www.xml.com/pub/a/2001/02/07/openoffice.html - some of that document remains relevant to the format today, so may be useful.
Reply all
Reply to author
Forward
0 new messages