fix issues with firefox display

This commit is contained in:
Amruth Pillai
2020-03-31 23:00:13 +05:30
parent 68a27016b9
commit 4b3b4fb843
2 changed files with 7 additions and 6 deletions

View File

@ -32,7 +32,7 @@ const App = () => {
<div className="h-screen overflow-hidden grid grid-cols-5 items-center"> <div className="h-screen overflow-hidden grid grid-cols-5 items-center">
<LeftSidebar /> <LeftSidebar />
<div className="z-0 h-screen col-span-3 overflow-scroll flex justify-center items-center"> <div className="z-0 h-screen col-span-3 flex overflow-scroll justify-center items-center">
<div id="page" ref={pageRef} className="shadow-2xl"> <div id="page" ref={pageRef} className="shadow-2xl">
{templates.find(x => theme.layout.toLowerCase() === x.key).component()} {templates.find(x => theme.layout.toLowerCase() === x.key).component()}
</div> </div>

View File

@ -25,16 +25,14 @@ const ActionsTab = ({ data, theme, dispatch }) => {
}; };
const printAsPdf = () => { const printAsPdf = () => {
pageElement.current.style.maxHeight = 'fit-content'; pageElement.current.style.display = 'table';
pageElement.current.style.overflow = 'visible'; pageElement.current.style.overflow = 'visible';
html2canvas(pageElement.current, { html2canvas(pageElement.current, {
scale: 6, scale: 5,
useCORS: true, useCORS: true,
allowTaint: true, allowTaint: true,
}).then(canvas => { }).then(canvas => {
pageElement.current.style.maxHeight = '29.7cm';
pageElement.current.style.overflow = 'scroll';
const image = canvas.toDataURL('image/jpeg', 1.0); const image = canvas.toDataURL('image/jpeg', 1.0);
const doc = new jsPDF('p', 'mm', 'a4'); const doc = new jsPDF('p', 'mm', 'a4');
const pageWidth = doc.internal.pageSize.getWidth(); const pageWidth = doc.internal.pageSize.getWidth();
@ -50,6 +48,9 @@ const ActionsTab = ({ data, theme, dispatch }) => {
const marginX = (pageWidth - canvasWidth) / 2; const marginX = (pageWidth - canvasWidth) / 2;
const marginY = (pageHeight - canvasHeight) / 2; const marginY = (pageHeight - canvasHeight) / 2;
pageElement.current.style.display = 'block';
pageElement.current.style.overflow = 'scroll';
doc.addImage(image, 'JPEG', marginX, marginY, canvasWidth, canvasHeight, null, 'SLOW'); doc.addImage(image, 'JPEG', marginX, marginY, canvasWidth, canvasHeight, null, 'SLOW');
doc.save(`RxResume_${Date.now()}.pdf`); doc.save(`RxResume_${Date.now()}.pdf`);
}); });