mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 16:51:33 +10:00
fix issues with firefox display
This commit is contained in:
@ -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>
|
||||||
|
|||||||
@ -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`);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user