Commit 20faeda2 authored by Babin Egor's avatar Babin Egor

Merge branch 'Serg' into 'master'

Serg

See merge request !6
parents c36d9d31 25966f55
{ {
"parser": "babel-eslint", // "parser": "babel-eslint",
"extends": "eslint:recommended", // "extends": "eslint:recommended",
"globals": { // "globals": {
"require": true, // "require": true,
}, // },
"rules": { // "rules": {
"strict": 0 // "strict": 0
} // }
} }
...@@ -81,12 +81,15 @@ ...@@ -81,12 +81,15 @@
"webpack-stream": "^5.2.1" "webpack-stream": "^5.2.1"
}, },
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.8.3",
"autosize": "^4.0.2", "autosize": "^4.0.2",
"axios": "^0.19.0", "axios": "^0.19.0",
"baron": "^3.0.3", "baron": "^3.0.3",
"choices.js": "^6.0.0", "choices.js": "^6.0.0",
"closest": "0.0.1", "closest": "0.0.1",
"html2canvas": "^1.0.0-rc.5",
"jquery": "^3.1.1", "jquery": "^3.1.1",
"jspdf": "^1.5.3",
"object-fit-images": "^3.2.3", "object-fit-images": "^3.2.3",
"svg4everybody": "^2.1.8", "svg4everybody": "^2.1.8",
"vee-validate": "^3.0.3", "vee-validate": "^3.0.3",
......
...@@ -6,3 +6,48 @@ ...@@ -6,3 +6,48 @@
// const $ = require('jquery'); // const $ = require('jquery');
// $( document ).ready(function() {}); // $( document ).ready(function() {});
import jsPDF from 'jspdf';
import "@babel/polyfill";
import html2canvas from "html2canvas";
let orderPdf = document.querySelector('#orderPdf');
let tableResult = document.querySelector('#table-content');
orderPdf.addEventListener('click', function(e)
{
e.preventDefault();
html2canvas(tableResult).then(function(canvas) {
let pdfData = canvas.toDataURL('image/png');
console.log(pdfData);
document.body.append(canvas);
});
/*
let byteChars = atob(pdfData);
let bytes = [];
for (let i = 0; i < byteChars.length; i++)
bytes[i] = byteChars.charCodeAt(i);
let blob = new Blob([new Uint8Array(bytes)], {type: 'application/pdf'});
// создаём object URL из Blob
let downloadUrl = URL.createObjectURL(blob);
console.log('File Size:', Math.round(byteChars.length / 1024), 'KB');
console.log(byteChars);
if(window.navigator && window.navigator.msSaveOrOpenBlob)
window.navigator.msSaveOrOpenBlob(blob);
else
{
let newWin = window.open(downloadUrl, '_blank', 'width=500,height=300,menubar=yes,scrollbars=yes,status=yes,resizable=yes');
newWin.focus();
newWin.print(); //чтобы эта строка сработала страница должна быть в сети, т.е. НЕ локально.
URL.revokeObjectURL(downloadUrl);
}
*/
});
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment