jsonresume-nix icon indicating copy to clipboard operation
jsonresume-nix copied to clipboard

build pdf

Open i-am-logger opened this issue 1 year ago • 1 comments

i-am-logger avatar Dec 02 '23 00:12 i-am-logger

This is something I would like as well, I might try tackle it

frogamic avatar Dec 06 '23 00:12 frogamic

It looks like the blessed way to build a pdf using resumed is to use puppeteer? Seems kind of annoying. https://github.com/rbardini/resumed/tree/main/examples/with-pdf-export

ShaddyDC avatar Oct 12 '24 21:10 ShaddyDC

It looks like the blessed way to build a pdf using resumed is to use puppeteer? Seems kind of annoying. https://github.com/rbardini/resumed/tree/main/examples/with-pdf-export

There were a long time since I've had a look at running puppeteer for any form of local or personal use.

However, I just had a look in nixpkgs and found https://search.nixos.org/packages?channel=24.05&show=puppeteer-cli in there, which is this following package: https://github.com/JarvusInnovations/puppeteer-cli

I've tried it locally by just pulling it in with nix-shell and running:

nix-shell -p puppeteer-cli

# For making a PDF
puppeteer print resume.html resume.pdf

# For making a screenshot
puppeteer screenshot resume.html resume.png

It's a bit weird for me because the screenshot comes out pretty decent, but still missing icons and such. The PDF sometimes comes out worse, sometimes I didn't get any visible text at all but not always.

However, this seems like a good way.

Update: Interesting find!

If I run:

puppeteer print <link-to-public-resume> resume.pdf --format A4

it does come out perfect, so it's probably something with environment or paths and not loaded correctly.

etu avatar Oct 13 '24 08:10 etu

I've just pushed: https://github.com/TaserudConsulting/jsonresume-nix/commit/b0d4ac3516f2a537f49bdfd76508e5feff91e960

It seems to work fairly well with the fullmoon theme, with the elegant theme it's more flakey.

It's not a very pretty implementation since it pulls in the dependencies and runs it as a process as the current user and I would rather have it inside the sandbox and output it to $out as it would be an isolated nix build. But hey! It's something and things can always be improved :slightly_smiling_face:

etu avatar Oct 13 '24 12:10 etu

Well that was fast, thanks a bunch! :)

ShaddyDC avatar Oct 13 '24 20:10 ShaddyDC