D
D
DromHour2020-02-14 17:42:05
JavaScript
DromHour, 2020-02-14 17:42:05

Creating a simple PDF through pure JS?

It is necessary to create PDF-files (static) through JS, while there is a code size limit - 50KB, so the same jsPDF does not roll, since it is already 1MB. All that is required is to add several objects in turn, such as: path, canvas, rectangle, line, text, and in addition apply filters. But here's the problem - I didn't find any documentation on this, so I have no idea how to even create an empty PDF file. Help with small plugins or documentation about this, please

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aetae, 2020-02-14
@DromHour

Your requirements are unique, which means they do not occur in the wild.
So download raw jsPdf or pdfmake and gut from everything you don't need. You will most likely meet the size with a margin, no one will do it for you (for free).

C
casoer, 2020-02-14
@casoer

Well, if it's on pure js without plugins, then https://www.iso.org/standard/51502.html and 747 pages of docks to help.

A
Alexander Aksentiev, 2020-02-14
@Sanasol

there is a code size limit - 50KB

with such conditions, only window.print() will generate a PDF for you.
Where do you want to find pdf implementation in 50kb?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question