Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct PDF Export #3252

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
296d2b0
Work in progress. Won't load CSS. Dunno why
dbolacksn Nov 26, 2023
67a4391
WIP
dbolacksn Dec 13, 2023
04187cf
Simple Underline token.
dbolacksn Dec 13, 2023
a88b256
A better regex for underlining.
dbolacksn Dec 14, 2023
1861c7d
Remove stray console.logs.
dbolacksn Dec 14, 2023
01b1c20
Merge branch 'master' into jsPDF
dbolacksn Dec 15, 2023
8dcf50b
More WIP
dbolacksn Dec 16, 2023
ee25a59
Contiued fail in progress
dbolacksn Dec 18, 2023
0470d13
Add optimized NC logo
G-Ambatte Oct 1, 2023
fe0cfcb
New file was unnecessary
G-Ambatte Oct 1, 2023
c9c5176
Add Credits styling to 5ePHB theme
G-Ambatte Oct 1, 2023
2f383d5
Add HB Credit snippet
G-Ambatte Oct 1, 2023
d0ccc4a
Capitalize C in NaturalCrit.com
G-Ambatte Oct 1, 2023
0337761
Change the text to include URL link
G-Ambatte Oct 1, 2023
e56ff93
Add underline on hover to link in credit
G-Ambatte Oct 1, 2023
c0cabbb
Move Credits snippet to Blank
dbolacksn Jan 16, 2024
b1f789f
More roadblocks?
dbolacksn Jan 17, 2024
889aad7
Merge branch 'master' into jsPDF
dbolacksn Jan 17, 2024
8bd8f0f
Merge remote-tracking branch 'origin/master'
dbolacksn Jan 17, 2024
8b31966
Revert "Remove stray console.logs."
dbolacksn Jan 18, 2024
ac9fc72
Revert "A better regex for underlining."
dbolacksn Jan 18, 2024
0c6c9fc
Revert "Simple Underline token."
dbolacksn Jan 18, 2024
0c010a0
Revert "WIP"
dbolacksn Jan 18, 2024
6beee49
Merge branch 'master' of github.com:naturalcrit/homebrewery
dbolacksn Jan 19, 2024
8fc6047
Merge branch 'master' of github.com:naturalcrit/homebrewery
dbolacksn Jan 20, 2024
fbc164a
Merge branch 'master' of github.com:naturalcrit/homebrewery
dbolacksn Jan 25, 2024
6740d3d
Merge branch 'master' into jsPDF
dbolacksn Jan 25, 2024
0163e22
Merge branch 'master' of github.com:naturalcrit/homebrewery
dbolacksn Jan 25, 2024
8ab2733
Merge branch 'master' of github.com:naturalcrit/homebrewery
dbolacksn Jan 26, 2024
f573356
Merge branch 'master' into jsPDF
dbolacksn Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion client/homebrew/pages/printPage/printPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const BREWKEY = 'homebrewery-new';
const STYLEKEY = 'homebrewery-new-style';
const METAKEY = 'homebrewery-new-meta';


import { jsPDF } from 'jspdf';
import * as html2canvas from 'html2canvas';


const PrintPage = createClass({
displayName : 'PrintPage',
getDefaultProps : function() {
Expand Down Expand Up @@ -54,8 +59,38 @@ const PrintPage = createClass({
};
});
}
window.html2canvas = html2canvas;
const pages = document.getElementsByClassName('pages')[0];
console.log(pages);
const doc = new jsPDF({
orientation : 'p',
unit : 'pt',
format : 'letter',
putOnlyUsedFonts : true,
});



if(this.props.query.dialog) window.print();
doc.html(pages, {
callback : function(doc) {
doc.save('test.pdf');
},
autoPaging : 'text',
html2canvas : {
allowTaint : true,
useCORS : false,
backgroundColor : null,
logging : true,
dpi : 300,
letterRendering : true,
width : doc.internal.pageSize.getWidth(),
height : doc.internal.pageSize.getHeight(),
scale : .75,
x : 0,
y : 0
},
windowWidth : getComputedStyle(pages.children[0]).width
});
},

renderStyle : function() {
Expand Down
Loading