Skip to content

AcroForm bug on page break / form is rendered on last page #725

@lukaselmer

Description

@lukaselmer

Are you using the latest version of jsPDF?

Yes. Exact version: f895888.

Steps to reproduce

  • Add form element
  • Add a page break
  • Add another form element
  • Render PDF

See also: renuo@cf2a53e and https://github.com/renuo/jsPDF/tree/acroforms-plugin-page-break-bug

Live example: http://jsbin.com/feyekuneme/edit?html,js,output

function run() {
      var doc = new jsPDF();
      doc.setFontSize(12);

      doc.text(10, 30, 'TextField 1:');
      var textField1 = new TextField();
      textField1.Rect = [50, 25, 30, 10];
      textField1.multiline = true;
      textField1.V = "The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse";//
      textField1.T = "TestTextBox";
      doc.addField(textField1);

      doc.addPage();

      doc.text(10, 50, 'TextField 2:');
      var textField2 = new TextField();
      textField2.Rect = [50, 45, 30, 10];
      textField2.multiline = true;
      textField2.V = "The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse";//
      textField2.T = "TestTextBox";
      doc.addField(textField2);

      doc.addPage();

      doc.text(10, 70, 'TextField 3:');
      var textField3 = new TextField();
      textField3.Rect = [50, 65, 30, 10];
      textField3.multiline = true;
      textField3.V = "The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse";//
      textField3.T = "TestTextBox";
      doc.addField(textField3);

      doc.save('Testy.pdf');
}

What I saw

All form elements are on the last page of the document (I suspect that the form is rendered after all pages, and that the page number of the form element should be placed is not stored).

What I expected

One form element on the first page, on on the second page, one on the last page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions