I am working on a feature that will allow the user to take the last stage of their pipeline and get a nice PDF out of it.
I have the server and client all playing nicely. What I have been unable to accomplish is getting the whole document into the pdf. It only captures a small portion.
I don't need multiple pages although that would be nice. I just want to capture everything no matter how long the render might be. There is potential to have 100 items for example image and checkboxes next to them. I need a whole pdf of that and so far I can only get a snapshot of a little portion of it.
I tried messing with with height options and various packages with absolutely no luck.
I'll provide what the renderSimpleForm ends up looking like on the browser. and what it comes up as a PDF.
code & images
import { jsPDF } from "jspdf";
import * as htmlToImage from 'html-to-image';
const handleSubmit = () => {
// //Before sending the action show in progress text and disable button
setPdf({inProgress: true})
//Creating the pdf blob
htmlToImage.toPng(document.getElementById('simpleForm'))
.then(function (dataUrl) {
var link = document.createElement('a');
link.download = 'my-image-name.jpeg';
const pdf = new jsPDF('p', 'mm', 'a4');
const imgProps= pdf.getImageProperties(dataUrl);
pdf.addImage(dataUrl, 'PNG', 0, 0);
//Send action to server
ClassInstancesActions.StorePassportPDFToDisk(pdf.output('blob'), productID)
});
}
return (
<div id="simpleForm" style={{ height: '9999px !important', width: '9999px !important' }}>
{renderSimpleForm()}
{showError()}
{renderSubmitCancel(disableSubmit)}
</div>
);
};


Ok after some time I have a solution that worked for my needs which were :
and extra:
I used https://www.npmjs.com/package/@progress/kendo-react-pdf
I used its savePDF function that allowed me to also have a template creating type functionality because it come free and is passed in as a prop in the options argument you'll see in the code.
Also there is a css selector that targets JUST the PDF'ed div passed already no need to specify what to show and what not to show, so you can actually manipulate the PDF right before it comes out completely from here.
In the video demo you'll see I have a MASSIVE div comes out to OVER 40 pages! Preserved my material and css styling and I could add whatever I want at will. I even added a watermark!
Hope this helps people out!