|
@@ -128,6 +128,29 @@ export function calculationWeek(val, format) {
|
|
|
return week;
|
|
|
}
|
|
|
|
|
|
+export function getPdfNoPage(name, title) {
|
|
|
+
|
|
|
+ html2Canvas(document.querySelector("#" + name), {
|
|
|
+
|
|
|
+ useCORS: true,
|
|
|
+ scale: 2,
|
|
|
+ dpi: window.devicePixelRatio * 1,
|
|
|
+ }).then((canvas) => {
|
|
|
+ const contentWidth = canvas.width;
|
|
|
+ const contentHeight = canvas.height;
|
|
|
+
|
|
|
+ const pageData = canvas.toDataURL("image/jpeg", 1.0);
|
|
|
+ const pdfWidth = ((contentWidth + 10) / 2) * 0.75;
|
|
|
+ const pdfHeight = ((contentHeight + 200) / 2) * 0.75;
|
|
|
+ const imgWidth = pdfWidth;
|
|
|
+ const imgHeight = (contentHeight / 2) * 0.75;
|
|
|
+ const PDF = new JsPDF("", "pt", [pdfWidth + 50, pdfHeight + 100]);
|
|
|
+ PDF.addImage(pageData, "jpeg", 33, 33, imgWidth, imgHeight);
|
|
|
+ PDF.save(title + ".pdf");
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
export function getPdf(title, num, domId = "pdfDom") {
|
|
|
const element = document.getElementById(domId);
|
|
|
|