Pechkin
Pechkin copied to clipboard
Size of page content is not OK
Hi, I have another problem with content of the PDF. I have created HTML. Simplified: it contains TABLE HR TABLE and this is wrapped by DIV. The width of tables is 826px and height about 1100px. In global config I have set up the PDF page size to A4. But my content is magnified up/down, but never is fit to the A4 page. If I try to print it in a browser, the preview looks OK, but PDF do not. Any suggestions, please?
I can't reproduce it. With .SetPaperSize(PaperKind.A4)
the table <table style="width: 826px; height: 1100px; background-color: gray;">
is fit into one page nicely.
Of course,
- I use default margins, and
- The content in my table isn't huge, so it doesn't cause table's stretch.
To further help you, I need the example, on which you get the strange behavior.
Hi, here is the link http://www.prevlec.cz/db/ShowReport.aspx?code=repTiskProtokolu&id0=280284&usrlg=FiaL79o12
So, what you need to do is have these two tables on different pages of the PDF file?
Well, I've got those tables on separate pages: http://yhub.ru/u/p/tmp7B74.tmp.pdf
That's the code:
SynchronizedPechkin sc = new SynchronizedPechkin(new GlobalConfig().SetPaperSize(PaperKind.A4));
byte[] buf = sc.Convert(new ObjectConfig().SetPrintBackground(true).SetAllowLocalContent(true).SetCreateForms(false).SetPageUri("http://www.prevlec.cz/db/ShowReport.aspx?code=repTiskProtokolu&id0=280284&usrlg=FiaL79o12"));
You can also try to use CSS3 property page-break-after
, like this:
<style type="text/css" media="screen,print">
// just put this into your styles:
.break_page_here { page-break-after: always; }
</style>
<!-- and then put this div where the page break is necessary -->
<div class="break_page_here "></div>
(from here: http://code.google.com/p/wkhtmltopdf/issues/detail?id=173) Note that putting the class on another elements (or using inline style attribute) could not work, but the above method does.
The problem is not the page separation, it works fine, but I recieve this PDF as result. The right and bottom margin is to big... The tables should fit to the A4 page. How to do that? PDF: (link removed)
When I added .SetZoomFactor(1.1)
to the ObjectConfig
it made the content fit the width of the page. Taking margins into account some proportions were off, but it's a start.
Yes, if when I used ZoomFactor(2.0) and IntelligentShringing(true), it works fine. Thanx