mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 16:51:33 +10:00
Merge pull request #66 from AmruthPillai/develop
Bugfix: Exporting PDF, no more margins!
This commit is contained in:
@ -11,7 +11,7 @@ ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
|||||||
COPY package.json /usr/src/app/package.json
|
COPY package.json /usr/src/app/package.json
|
||||||
|
|
||||||
## install app dependencies
|
## install app dependencies
|
||||||
RUN npm install --silent
|
RUN npm install
|
||||||
|
|
||||||
## copy files
|
## copy files
|
||||||
COPY . /usr/src/app
|
COPY . /usr/src/app
|
||||||
|
|||||||
@ -11,7 +11,7 @@ ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
|||||||
COPY package.json /usr/src/app/package.json
|
COPY package.json /usr/src/app/package.json
|
||||||
|
|
||||||
## install app dependencies
|
## install app dependencies
|
||||||
RUN npm install --silent
|
RUN npm install
|
||||||
|
|
||||||
## start app
|
## start app
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
@ -30,7 +30,7 @@ Something that's missing on the app that's halting your progress from making the
|
|||||||
|
|
||||||
## Translation
|
## Translation
|
||||||
|
|
||||||
Translating the app into your language has never been easier. Thanks to [Crowdin](https://crowdin.com/), a localization management tool, anyone can translate strings without having to mess arounf with a bunch of files. For information on how to translate the app into your own language, please visit the [Translation Secion](/translation/) of the documentation.
|
Translating the app into your language has never been easier. Thanks to [Crowdin](https://crowdin.com/), a localization management tool, anyone can translate strings without having to mess around with a bunch of files. For information on how to translate the app into your own language, please visit the [Translation Secion](/translation/) of the documentation.
|
||||||
|
|
||||||
## Commit Code
|
## Commit Code
|
||||||
|
|
||||||
|
|||||||
6
package-lock.json
generated
6
package-lock.json
generated
@ -16844,9 +16844,9 @@
|
|||||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||||
},
|
},
|
||||||
"uuid": {
|
"uuid": {
|
||||||
"version": "7.0.2",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
|
||||||
"integrity": "sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw=="
|
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
|
||||||
},
|
},
|
||||||
"v8-compile-cache": {
|
"v8-compile-cache": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
"react-scripts": "3.4.1",
|
"react-scripts": "3.4.1",
|
||||||
"react-toastify": "^5.5.0",
|
"react-toastify": "^5.5.0",
|
||||||
"tailwindcss": "^1.2.0",
|
"tailwindcss": "^1.2.0",
|
||||||
"uuid": "^7.0.2",
|
"uuid": "^7.0.3",
|
||||||
"vuepress": "^1.4.0"
|
"vuepress": "^1.4.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
{
|
{
|
||||||
"title": {
|
"title": {
|
||||||
"label": "Título",
|
"label": "Nombre"
|
||||||
"placeholder": "Desarrollo en Android Nanodegree"
|
|
||||||
},
|
},
|
||||||
"subtitle": {
|
"subtitle": {
|
||||||
"label": "Subtítulo",
|
"label": "Autoría"
|
||||||
"placeholder": "Udacity"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"placeholder": "Puede escribir sobre lo que aprendiste de tú programa de certificación."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"title": {
|
"title": {
|
||||||
"label": "学校"
|
"label": "名称"
|
||||||
},
|
},
|
||||||
"subtitle": {
|
"subtitle": {
|
||||||
"label": "颁发机构"
|
"label": "颁发机构"
|
||||||
|
|||||||
@ -6,6 +6,6 @@
|
|||||||
"label": "主修课程"
|
"label": "主修课程"
|
||||||
},
|
},
|
||||||
"grade": {
|
"grade": {
|
||||||
"label": "等级"
|
"label": "学分"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"key": {
|
"key": {
|
||||||
"label": "学校"
|
"label": "名称"
|
||||||
},
|
},
|
||||||
"rating": {
|
"rating": {
|
||||||
"label": "等级"
|
"label": "等级"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const TabBar = ({ tabs, currentTab, setCurrentTab }) => {
|
|||||||
const tabsRef = useRef(null);
|
const tabsRef = useRef(null);
|
||||||
|
|
||||||
const scrollBy = x => {
|
const scrollBy = x => {
|
||||||
const index = tabs.find(tab => tab.key === currentTab);
|
const index = tabs.findIndex(tab => tab.key === currentTab);
|
||||||
tabsRef.current.scrollLeft += x;
|
tabsRef.current.scrollLeft += x;
|
||||||
|
|
||||||
if (x < 0 && index > 0) {
|
if (x < 0 && index > 0) {
|
||||||
|
|||||||
@ -88,7 +88,7 @@ const Castform = () => {
|
|||||||
data.skills &&
|
data.skills &&
|
||||||
data.skills.enable && (
|
data.skills.enable && (
|
||||||
<div>
|
<div>
|
||||||
<Heading title="Skills" />
|
<Heading title={data.skills.heading} />
|
||||||
<ul className="list-none px-5">{data.skills.items.map(SkillItem)}</ul>
|
<ul className="list-none px-5">{data.skills.items.map(SkillItem)}</ul>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -110,12 +110,17 @@ const saveAsPdf = (pageRef, panZoomRef) => {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
html2canvas(pageRef.current, {
|
html2canvas(pageRef.current, {
|
||||||
scale: 5,
|
scale: 6,
|
||||||
useCORS: true,
|
useCORS: true,
|
||||||
allowTaint: true,
|
allowTaint: true,
|
||||||
}).then(canvas => {
|
}).then(canvas => {
|
||||||
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({
|
||||||
|
orientation: 'portrait',
|
||||||
|
unit: 'px',
|
||||||
|
format: [canvas.width, canvas.height],
|
||||||
|
});
|
||||||
|
|
||||||
const pageWidth = doc.internal.pageSize.getWidth();
|
const pageWidth = doc.internal.pageSize.getWidth();
|
||||||
const pageHeight = doc.internal.pageSize.getHeight();
|
const pageHeight = doc.internal.pageSize.getHeight();
|
||||||
|
|
||||||
@ -125,16 +130,15 @@ const saveAsPdf = (pageRef, panZoomRef) => {
|
|||||||
|
|
||||||
const canvasWidth = canvas.width * ratio;
|
const canvasWidth = canvas.width * ratio;
|
||||||
const canvasHeight = canvas.height * ratio;
|
const canvasHeight = canvas.height * ratio;
|
||||||
|
// const marginX = (pageWidth - canvasWidth) / 2;
|
||||||
const marginX = (pageWidth - canvasWidth) / 2;
|
// const marginY = (pageHeight - canvasHeight) / 2;
|
||||||
const marginY = (pageHeight - canvasHeight) / 2;
|
|
||||||
|
|
||||||
panZoomRef.current.autoCenter(0.7);
|
panZoomRef.current.autoCenter(0.7);
|
||||||
|
|
||||||
doc.addImage(image, 'JPEG', marginX, marginY, canvasWidth, canvasHeight, null, 'SLOW');
|
doc.addImage(image, 'JPEG', 0, 0, canvasWidth, canvasHeight, null, 'SLOW');
|
||||||
doc.save(`RxResume_${Date.now()}.pdf`);
|
doc.save(`RxResume_${Date.now()}.pdf`);
|
||||||
});
|
});
|
||||||
}, 250);
|
}, 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
Reference in New Issue
Block a user