Forum How do I...?

Output is always A4

adnanY
Hi there,
just started testing princeXML, so fa so superb!!!
But my newest test was to create a 20cm x 20cm sized PDF and wrote this stylesheet:
<style>
@prince-pdf { prince-pdf-output-intent: url("ISOcoated_v2_eci.icc") }
@page { size: 20cm 20cm; }
body {
width: 200mm;
height: 200mm;
font-family: Arial, Helvetica, sans-serif;
font-size: 20pt;
}
.wrapper {
background-color: green;
}
</style>

But the result wasn A4-PDF. What did I wrong?

thx in advance...
mikeday
I'm not sure what you mean by wasn't A4, the result should be 20cm by 20cm as you specified. However, you may need to specify "margin: 0" on the @page rule to disable the default page margins.
adnanY
sorry, that "wasn" should be "was" not "wasnt"...
but i found the problem: it was my mistake, just had "$prince->setPageSize("A4");" in my php script.

thx.

ps: can i close or maybe delete this thread?
mikeday
No problem then! Although you might still need to adjust the page margins. :)
adnanY
Hi guys,
hi mikeday,

can someone explain to me why the size of the generated pdf is 215,9 x 279,4 mm, while the html-body was set to 210 x 297mm?
its wider but smaller??? hmm...
margin was set with @page{margin:0} and $prince->setPageMargin("0.0mm") ;-)

thx in advance...


  1. prince215279.PNG24.1 kB

Edited by adnanY

adnanY
should i open a new thread?
adnanY
sorry, but i figured it out. i have to set the page size seperatly. did it now by $prince->setPageSize("2100mm 297mm")


...