Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
ecouniversal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Babin Egor
ecouniversal
Commits
96f69dfb
Commit
96f69dfb
authored
Feb 27, 2020
by
SergeyEzhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
something done
parent
987a04e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
script.js
src/js/script.js
+21
-22
calculation-result.pug
src/pages/calculation-result.pug
+1
-0
No files found.
src/js/script.js
View file @
96f69dfb
...
...
@@ -12,20 +12,23 @@ import "@babel/polyfill";
import
html2canvas
from
"html2canvas"
;
let
orderPdf
=
document
.
querySelector
(
'#orderPdf'
);
let
tableResult
=
document
.
querySelector
(
'
.table-responsive
'
);
let
tableResult
=
document
.
querySelector
(
'
#table-content
'
);
orderPdf
.
addEventListener
(
'click'
,
function
(
e
)
orderPdf
.
addEventListener
(
'click'
,
async
function
(
e
)
{
e
.
preventDefault
();
html2canvas
(
tableResult
).
then
(
function
(
canvas
)
{
let
pdfData
=
canvas
.
toDataURL
(
'image/png'
);
await
html2canvas
(
tableResult
).
then
(
function
(
canvas
)
{
document
.
body
.
append
(
canvas
);
});
let
byteChars
=
btoa
(
pdfData
);
// {
// let pdfData = canvas.toDataURL('image/png');
// console.log(pdfData);
// document.getElementById("canvasImg").src= canvas.toDataURL();
/*
let byteChars = atob(pdfData);
let bytes = [];
for (let i = 0; i < byteChars.length; i++)
bytes[i] = byteChars.charCodeAt(i);
...
...
@@ -36,21 +39,17 @@ orderPdf.addEventListener('click', function(e)
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);
}
// let doc = new jsPDF();
//
// doc.save(downloadUrl, 1, 1);
*/
// 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);
// }
});
});
src/pages/calculation-result.pug
View file @
96f69dfb
...
...
@@ -130,3 +130,4 @@ block page
.row.justify-content-center
.col-lg-8
p Если у Вас остались вопросы, Вы можете связаться с менеджером по телефону 8 (800) 100-66-06 или с помощью #[a(href='', data-toggle='modal', data-target='#modal-callback') формы обратной связи]
img(src="", id="canvasImg")
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment