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

Developer docs and how to customize PDF options with JSON Resume CLI and custom themes #617

Open
alicescfernandes opened this issue Jul 6, 2021 · 2 comments

Comments

@alicescfernandes
Copy link

alicescfernandes commented Jul 6, 2021

Hi!
This is not an issue per se, but the docs also don't mention how to develop themes. While trying to debug some rendering issues on puppeteer, i came across a way to customize rendering. By default, resume-cli will render a PDF with in letter format. In Europe we use A4 paper. Also, resume-cli doesn't respect @ media print rules. This can be changed by setting mediaType: 'print' on the pdfRenderOptions

In order to customize the rendering options, you need to export a pdfRenderOptions on the index.js of the theme. I believe that this only works for local themes though

Example code

module.exports = {
	render: render,
	pdfRenderOptions: {
		format: 'A4',
		mediaType: 'print',
		pdfViewport: { width: 1920, height: 1280 },
		margin: {
			top: '0.4in',
			bottom: '0.4in',
			left: '0.4in',
			right: '0.4in',
		},
	},
};

The PDF options that puppeteer accepts on page.pdf are also accepted by the resume-cli. You can check available PDF options here

Is there anyway that we can develop some sort of documentation for theme developers? I would be willing to work on that

@alicescfernandes alicescfernandes changed the title Customizing PDF options with JSON Resume CLI and custom themes Developer docs and how to customize PDF options with JSON Resume CLI and custom themes Jul 6, 2021
@asbjornu
Copy link

asbjornu commented Apr 6, 2023

I was just hit by this void of information and thankfully found this issue giving me a bit more information and context. More elaborate documentation in the PDF + custom theme area would be highly appreciated for sure!

asbjornu added a commit to asbjornu/jsonresume-theme-golden that referenced this issue Apr 10, 2023
Add print options as per the following information:

jsonresume/resume-cli#617
asbjornu added a commit to asbjornu/jsonresume-theme-golden that referenced this issue May 7, 2023
Add print options as per the following information:

jsonresume/resume-cli#617
@XuluWarrior
Copy link
Contributor

I've been trying to make my theme more print friendly and came across this issue.
Having played with it a bit my observations are

module.exports = {
  render: render,
  pdfViewPort: { ... },
  pdfOptions: { ... }
}
module.exports = {
  ...
  pdfOptions: {
    width: "1200px",
    height: "1692px", // A4 ratio
    format: undefined
 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants