foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser
http://pdfkit.org/
MIT License
9.77k stars 1.14k forks source link

Create text elements as vectors #869

Open a-elliott opened 5 years ago

a-elliott commented 5 years ago

Is it possible (or could it be possible to develop in future) a function to allow a text element to be created (using font, style, size, colour, options) but instead of embedding it into the PDF as a text element, could it be rendered as a vector.

Therefore if you open the PDF in Illustrator or Inkscape, etc the text would not be editable, but would essentially be displayed as outlines (using an Illustrator term).

I have some software that I need to develop a PDF for and open into the software, but it cannot render text elements (whether fonts are embedded/available or not). It can only display the vector paths of a PDF document. So i would like to build the PDF with text (and style it with all the usual text styling methods) but when the PDF is presented, the text is actually a group of filled vector paths.

Appreciate any feedback on this.

nrkn commented 5 years ago

fontkit (which pdfkit uses under the hood) can definitely render text as vectors, so you might be able to look at trying to find where pdfkit calls fontkit and see if you can intercept/modify/hack in some kind of temporary solution