Terry H
Terry H

Reputation: 340

Can jsPDF do page breaks?

I am trying to implement the creation of a PDF document on the front end using jsPDF that is currently done on the back end using SSRS (SQL Server Reporting Service).

The issue is pagination. As near as I can tell there is no "easy" way to get jsPDF to break up an HTML document into pages based upon the size set in the jsPDF constructor.

Is there a way to do that? To take a pregenerated HTML document and pass it along with a page size definition to jsPDF so that it will be able to break up the document into the appropriate number of pages of that size?

var doc = new jsPDF('p', 'in', [8.5, 11]);

doc.addHTML($('#pregeneratedModal'),
    function () {
        doc.save('Test.pdf');
    });

This is not working for me, but is there a way to do the thing I describe above?

Upvotes: 3

Views: 6742

Answers (1)

Dmytro Myronenko
Dmytro Myronenko

Reputation: 73

Please use this.

doc.addPage();

Upvotes: 0

Related Questions