How to export PDF from a long sharepoint online form?

I have a form in sharepoint online which has many fields.
I would like to use the export to pdf function, and then print it out.

However, the pdf has 1 page only.


It cannot print out 1 page by 1 page.

I tried most of this How to save SharePoint form as PDF for printing — SharePoint forms , but most of that are not worked.

Is there any good method to export pdf for Print it out?

Hello @itapps,

Have you tried defining the paper size or adding a Page Breaks?

For complex forms we suggest creating PDF from the template using the Plumsail Documents or Power Automate flow.

@mnikitina I tried page size, but no change to the pdf size.
For example, I just copy this, but no change.

fd.pdfOptions = {
paperSize: 'A4',
landscape: false,
margin: {
left : "20mm"
top : "40mm",
right : "20mm"
bottom : "40mm"
}
};

And I also tried page breaks, It is too complicated and quite bad looks because my form is too long.

@itapps,

There have you placed the code? Are you running the code within spRendered event like this:

fd.spRendered(function() {
    fd.pdfOptions = {
         paperSize: 'A4'
    };
});

I tried your code.
It is fine to separate few page, but not whole form.

There are only 5 pages which are not including whole form.

otherwise, the size scale of the form in the PDF is different with the form.
Can I set it exact same scale?

Hello @itapps,

I'm sorry, the screenshot is too small, I don't see that is displayed in the end of the form. Is it a List or Library or Data Table control? If so, try adding the page break before and after the control.

And as I mentioned before, for large complex forms we suggest creating the PDF file from the template.