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

How i get dpi of chrome #1468

Open
helios741 opened this issue Apr 17, 2024 · 0 comments
Open

How i get dpi of chrome #1468

helios741 opened this issue Apr 17, 2024 · 0 comments

Comments

@helios741
Copy link

What versions are you running?

$ go list -m github.com/chromedp/chromedp
github.com/chromedp/chromedp v0.8.5
$ google-chrome --version
 chromium-browser --version
Chromium 93.0.4577.82
$ go version
1.18

What did you do? Include clear steps.

i have a requirement that convert all content of url to one page pdf.

i test it in my Mac and set DPI is 96. it's work. but in k8s online environment it's not work, which had white content in bottom.
image

_, _, _, _, _, cs, err := page.GetLayoutMetrics().Do(ctx)
if err != nil {
	return components.ErrorChromedpFail.Sprintf(err)
}

paperHeight = cs.Height / float64(96/options.PageCount)
paperWidth = cs.Width / 96

printToPDF := page.PrintToPDF().
	WithTransferMode(page.PrintToPDFTransferModeReturnAsStream).
	WithPrintBackground(false).
	WithDisplayHeaderFooter(true).

What did you expect to see?

i'd to know the DPI to resolve it.

What did you see instead?

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

1 participant