Forum How do I...?

css issue with legal paper and landscape

epanagio
When I print the pdf the output doesn't consume the whole page of the legal paper. I open the pdf with Preview (a mac program to view pdfs) and the paper size and orientation are wrong. If I correct the paper and orientation it prints perfectly.

This is the css I am using

<style type="text/css">
p.breakhere {page-break-before:always;}
body {font-size:10pt;}
table.pdf, tr.pdf, th.pdf, td.pdf{border:1px solid black; border-spacing:0px;}
tr[valign=top] > td { vertical-align: top }
@page Legal { size: 8.5in 14in; }
@page { size: Legal landscape; }
@page { margin: .4in }
</style>

I tried changing
@page Legal { size: 8.5in 14in; }
@page { size: Legal landscape; }
to
@page US Legal { size: 8.5in 14in; }
@page { size: US Legal landscape; }
but made not difference

Do you have any ideas?
mikeday
Just one rule should be sufficient:
@page {
    size: Legal landscape;
    margin: 0.4in
}
epanagio
I have reduced it down to:
<html>
<head>
<style type="text/css">
@page { size: Legal landscape;
margin: 0.4in }
</style>
</head><body>
Hello!
</body>
</html>

I create the pdf, and when I try to print it comes out as 8 1/2 x 11 letter.

The version is:
prince --version
Prince 8.1 rev 5
Copyright 2002-2013 YesLogic Pty. Ltd.
Professional License

Help!
mikeday
If you check the PDF in Acrobat, what does it say under File > Properties > Page Size?
epanagio
I am confused.
It does say 14 x 8 1/2!!!!
If I try to print from my mac it doesn't print properly. If I change the settings in the print menu to be Legal and landscape it prints perfectly.
  1. clipping.jpg56.6 kB
    Clipping
mikeday
Perhaps it's trying to scale it to what it thinks is the right size. What if you try this:
@prince-pdf {
    prince-pdf-print-scaling: none
}
epanagio
This is the print window using Adobe Acrobat.
It does see it rotated but still 8 1/2 x 11.
  1. clipping.jpg203.5 kB
    Print window
mikeday
Hmm, Page Scaling is still showing up as "Shrink to Printable Area". The print-scaling property above should disable that, but it probably won't enable "Choose paper source by PDF page size", which is what we want in this case. I'm not sure how to enable that by default; after all, not everyone has every paper size available, either.
epanagio
I tried the following but the output was the same:

<html>
<head>
<style type="text/css">
@prince-pdf {prince-pdf-print-scaling: none}
@page { size: Legal landscape; margin: 0.4in }
</style>
</head>
<body>
Hello!
</body>
</html>
mikeday
I think we might be running out of options here. The PDF specification includes "PickTrayByPDFSize" field that we don't currently support in Prince. But then it also has this note:
Note: This setting has no effect on Mac OS systems, which do not provide
the ability to pick the input tray by size.
epanagio
Hey Mike.
So you are saying that the user will have to modify the settings in the print menu to get the correct output? If that is the only option, I don't mind it, but at least I know this is the only option available here.

But, am I the first user of prince that is trying to print on legal paper and rotated? Wow!
mikeday
It might be the only option. I made a test PDF attached below using the PickTrayByPDFSize field; can you see if this has any effect on the print dialog?
  1. legal.pdf12.0 kB
epanagio
Nope.
Still shows it as letter and portrait.
mikeday
That's a pity, it works on Linux, so I guess they weren't kidding about MacOS X. In that case I don't think we have any further options.
epanagio
I just tried it on a CentOs server and the output is the same.
mikeday
You mean running Prince on CentOS, or running Acrobat? When I use non-Acrobat PDF viewers on Linux they just default to A4 for me.
epanagio
The input is:
<html>
<head> 
	<style type="text/css">
		@prince-pdf {prince-pdf-print-scaling: none}
		@page { size: US-Legal landscape; margin: 0.4in }
	</style>
</head>
<body>
Hello!
</body>
</html>

The output is attached.
  1. pdf-test.pdf13.1 kB
    CentOS output

Edited by mikeday

epanagio
Sorry for the confusion. I added the message "The output is attached." in the middle of the html file.
mikeday
You can edit your post! In fact, I just edited for you, to demonstrate. :)

But back on track, you should get the same PDF output whichever operating system you run Prince on, so it is no surprise that it does not differ when you run on CentOS. The file I attached earlier (legal.pdf) has an extra flag set (PickTrayByPDFSize) which for me makes it default to the right paper size when I view the PDF in Acrobat on Linux or Windows. We don't support this flag in Prince yet, and there was the suggestion in the PDF specification that it has no affect on MacOS X.
epanagio
I understand.
We will put a disclaimer when emailing the pdfs to process them accordingly. No problem.

Thanks for the help Mike.
epanagio
Would this be addressed in a later release of prince?
mikeday
If the extra flag doesn't make a difference on MacOS X, then I don't see any way we can change this behaviour on our side. Someone needs to talk to Apple, I think.
epanagio
Hey Mike.
Sorry to bother you but I downloaded the file legal.pdf on a windows computer and worked like a charm. What is the "PickTrayByPDFSize" syntax, and where would I insert it? (Ha. I edited this post all by myself)

Thanks

Edited by epanagio

mikeday
Prince doesn't support it yet, but since it is useful we will add it in the next maintenance release of Prince 9, due shortly. The syntax will be:
@prince-pdf {
    prince-pdf-paper-tray: pick-tray-by-pdf-size
}
epanagio
THANKS!
I looked around the site but I couldn't see any information about maintenance releases. How do I find out about them?
mikeday
You could subscribe to the news forum (click the eye icon next to the new topic button), then you will receive an email when we make new announcements.
mikeday
Today we have released Prince 9 rev 4, which includes the new prince-pdf-paper-tray property as discussed.