2

I'm trying to create a .pdf book with HTML and CSS. I did this once with 72dpi and it worked fine. Now I want to do the same with a 300dpi resolution.

I'm using A4 page size and Prince XML to convert the HTML file to .pdf For the last project I used

width: 21cm;
height: 29.7cm;

and it worked fine. A resolution of 300dpi results in a page of the size 3508px x 2480px. If I use this as a style it's displayed correctly in the browser, but if I open the print preview or convert it to .pdf via prince, the fonts are bigger, and more pages than one are created.

I assume that a width of 595px (21cm=8.268inch=595px@72dpi) is used.

How can I force the print view to be 2480px wide as well?

Bernd Strehl
  • 2,852
  • 4
  • 24
  • 43
  • 1
    it is really impossible! http://stackoverflow.com/questions/22885854/how-can-i-print-html-page-at-300-dpi-resolution –  Sep 25 '16 at 12:14
  • No no no, dots are not pixels. On a 300 dpi device, you have a different _dot per pixel ratio_. See, for instance the [MDN article on resolution](https://developer.mozilla.org/en/docs/Web/CSS/resolution). The easiest thing is to work on the assumption that the printer is 96 pixels per inch (and it will have 3.125dppx). – Mr Lister Sep 25 '16 at 13:55
  • 1
    @MrLister how can I apply this to the problem? – Bernd Strehl Sep 25 '16 at 14:02

0 Answers0