chromedp / chromedp

A faster, simpler way to drive browsers supporting the Chrome DevTools Protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How i get dpi of chrome

helios741 opened this issue · comments

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?