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

Generating a PDF results in a non A4 format #78

Open
GG-better opened this issue May 16, 2018 · 3 comments
Open

Generating a PDF results in a non A4 format #78

GG-better opened this issue May 16, 2018 · 3 comments

Comments

@GG-better
Copy link

GG-better commented May 16, 2018

Hey there,
After having followed the installation instructions I used the respective command to generate a pdf file. In fact, a pdf file is generated, but its format is not A4 but a really tiny or miniature version sample.pdf
(please see the file below: "sample.pdf").

To generate the pdf file mentioned above I used the following command (as shown in the example section):

./bin/md2resume pdf examples/source/sample.md examples/output/

If I use the command to generate a html file, the resulting output looks like fine (just as the provided example file). Only the pdf generation is different than expected.

Could anybody give me a hint how I could resolve this issue getting a pdf in A4 format (which might be the default setting)? Many thanks in advance!

PS: I have installed the latest version of wkhtmltopdf on my OSX.

@craig-davis
Copy link
Contributor

I don't think it can be set via CSS. I think instead it may need to be added here when it calls wkhtmltopdf: https://github.com/there4/markdown-resume/blob/master/src/Resume/Command/PdfCommand.php#L86

With the --page-size A4 option. This would be a great option to add, but for now you could try that out and see how it goes.

@GG-better
Copy link
Author

Thanks a lot, @craig-davis !!!
You pointed me to the right code part! I played around with different options to wkhtmltopdf. Using the option --page-size A4 didn't solve the size issue mentioned above. However, a strong increase of the option --dpi (from 300 to 1800) solved the issue. Now the resume in the output pdf file is large enough. Finally, I used this code:
exec('wkhtmltopdf --dpi 1800 ' . $pdfSource .' ' . $destFilename);
Thank you,
GG

@danielklim
Copy link
Contributor

I've addressed this issue in #84. If that PR is accepted, it will allow users to pass through arguments to the wkhtmltopdf engine instead of hardcoding PDF formatting in the PHP file. For example, for a PDF with 1in margins, Letter size and 300 dpi, the command would be invoked as something like:

md2resume pdf -k \
	--pdfargs="--dpi 300 -s Letter -T 1in -B 1in -L 1in -R 1in --print-media-type" \
	-t modern \
	./src/resume.md ./

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