0

I have developed a service that allows users to create a SVG diagram (I've used d3.js), also together with the diagram some text content is created using ace.js.

Summarizing I have :

  • SVG Content generated by D3
  • Text Content generated by ACE Editor

In particular, I have been offering this service to client using node.js .

Do you know any ways to create a PDF which includes both SVG picture and text ?

EDIT: I can accept both client and server-side solution to address my issue.

Edge7
  • 681
  • 1
  • 15
  • 35

1 Answers1

0

SVG file format allows you to define text elements ( and tags) and to apply text styles. In the case a regular SVG-to-PDF converter, probably Apache Batic, would be sufficient.

If you want to combine SVG and HTML tags/texts in the same document - you need to look for a HTML-to-PDF converter with SVG graphics support. I would recommend to try PhantomJS (free) and PD4ML (commercial)

If you really need to mix SVG tags with a raw text, an enclosing of an entire document content to <pre> and </pre> tags and a passing the result to HTML-to-PDF converter should do the trick.

zfr
  • 339
  • 4
  • 11