Forum How do I...?

Top margin measurement is different in PDF output.

Balaa
I'm using the mentioned below margin values for page measurement, but PDF shows the different measurement (refer the attached image file). Please let us know the reason for this issue.

CSS:
@page { size: 155mm 235mm;}

@page {margin: 21.15mm 19mm 22.15mm 19mm;}


  1. Untitled.png175.6 kB
mikeday
You may need to try again with the latest build, as Prince 10 rounds page sizes to the nearest point (1/72") unit.
Balaa
I have used latest version of Prince 10 (i.e prince-10r7-setup.exe)

Edited by Balaa

mikeday
Yes you need to use an even more latest one, that I linked above.
Balaa
I have tried, but I'm getting the same output.
mikeday
I've attached this simple document converted to PDF:
<html>
<head>
<style>
@page {
    size: 155mm 235mm;
    margin: 21.15mm 19mm 22.15mm 19mm;
    background: yellow
}

body { background: aqua }
</style>
</head>
<body>
<h1>Heading</h1>
</body>
</html>

In the generated PDF the page size is given in points:
/MediaBox [0 0 439.3701 666.1417]

This translates to 155x235mm as expected for the sheet of paper.
We draw a cyan rectangle background for the page body:
53.8583 62.7874 331.6535 543.4016 re

The last two numbers are the width and height, again in points (1/72 of an inch). This translates to 117x191.7mm, which is exactly what you would expect from the page size and margin dimensions.

Everything seems to check out, so I am puzzled where is the discrepancy. Do you see any problems if you open the attached PDF in Acrobat?
  1. page.pdf14.2 kB
Balaa
I have checked the PDF in Acrobat, but it shows (cropped page size is: 117.30x191.83 mm).

I have attached my HTML and CSS file for your reference. Please check the actual page size at your side.
  1. BookFrontmatter.html2.3 kB
  2. BookSeriespage.html2.1 kB
  3. Booktitlepage.xhtml0.8 kB
  4. HTML_t1.css2.2 kB
mikeday
I don't know how Acrobat is deciding on the cropped page size, it doesn't seem to match anything in the PDF.
mikeday
Checking Acrobat DC it seems that the numbers are coming from the rectangle that was manually drawn with the mouse, can you try clicking Set to Zero to clear it?