Skip to content

Commit 3a1b3b9

Browse files
author
dphuang2
committed
TODO spacing left right and two page
1 parent ad8c0a4 commit 3a1b3b9

File tree

7 files changed

+989
-74
lines changed

7 files changed

+989
-74
lines changed

markdown-resume/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
11
resume.pdf
22
resume.html
3+
4+
# Node
5+
node_modules/
6+
package-lock.json
7+
8+
# macOS
9+
.DS_Store
10+
.AppleDouble
11+
.LSOverride
12+
._*
13+
.DocumentRevisions-V100
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
.com.apple.timemachine.donotpresent

markdown-resume/generate-pdf.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const puppeteer = require("puppeteer");
2+
3+
async function generatePDF() {
4+
const browser = await puppeteer.launch();
5+
const page = await browser.newPage();
6+
await page.goto(`file://${process.cwd()}/resume.html`, {
7+
waitUntil: "networkidle0",
8+
});
9+
await page.pdf({
10+
path: "resume.pdf",
11+
format: "A4",
12+
margin: {
13+
top: "1cm",
14+
right: "2cm",
15+
bottom: "2cm",
16+
left: "1cm",
17+
},
18+
});
19+
await browser.close();
20+
}
21+
22+
generatePDF();

markdown-resume/generate-pdf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Generate HTML first
44
pandoc resume.md -f markdown -t html -c resume-stylesheet.css -s -o resume.html
55
# Use weasyprint to convert HTML to PDF
6-
weasyprint resume.html resume.pdf
6+
node generate-pdf.js

markdown-resume/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "markdown-resume",
3+
"version": "1.0.0",
4+
"description": "This repo allows you to build/maintain your resume in a Markdown file, and then publish it into an HTML or PDF file. Technically, you could output it into any file you wanted with pandoc, or wkhtmltopdf, but I wasn't interested in those scenarios so I explore those avenues.",
5+
"main": "generate-pdf.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"puppeteer": "^23.10.0"
14+
}
15+
}

0 commit comments

Comments
 (0)