
- #Different margins on different pages of word how to#
- #Different margins on different pages of word pdf#
- #Different margins on different pages of word full#
The page-break-before:always on the second DIV is not required. This way you are basically implementing the margins in your HTML. However contents in the second DIV will have whatever margins you specify on your second DIV. This way the first page contents will not have any margins.
#Different margins on different pages of word full#
You would then run ConvertHtml with the above HTML on full width with no margins. Other contents that flow through multiple pages If using separate ConvertHtml calls is not an option for you, you can format your HTML into something like this: Custom paging will not change this rule because paging deals with Y axis, not X axis. So a single width value for the entire conversion is an iron rule that can not be bent. The entire HTML layout engine is designed on the notion of having a fixed width and then flow the document vertically however long as needed. You can not have a window on screen that is wider on the top half and narrower on the bottom half - that can only be achieved by using two separate windows. That window, just like a normal on screen browser window, can only have a single width value.
#Different margins on different pages of word pdf#
This is because internally the HTML to PDF converter creates an off screen browser window, then load and render the HTML into that window. This is true even if you use custom paging.

The hard rule here is no matter what you do, one ConvertHtml can only have a single OutputArea.Width. Hi, You will either have to use two separate ConvertHtml calls, or modify your HTML to implement the margins in your HTML. Thanks! (Edit: originally posted this in General Discussion by accident, moving it under Support.)
#Different margins on different pages of word how to#
} Any clues as to how to accomplish this would be appreciated. HtmlToPdfResult = session.RenderAsPDF(doc) = new RectangleF(lastPageLeft, lastPageTop, lastPageWidth, lastPageHeight) = new RectangleF(left, top, width, height) Paginator paginator = session.CreatePaginator()

= new RectangleF(firstPageLeft, firstPageTop, firstPageWidth, firstPageHeight) Using (HtmlToPdfSession session = HtmlToPdfSession.Create(pdfOptions)) I am guessing the rule that there cannot be multiple OutputAreas for each ConvertHtml() call applies to HtmlToPdfSession.RenderAsPDF() as well. I've tried doing something like the below, but clearly this is not the right way to approach it, as margins for the entire report just end up based on the last OutputArea I set (the one for the last page). I've read this: And have tried using the Paginator class, but I am unclear how to use it with different OutputAreas.

I'm unsure how to divide the HTML up per page, in a way that matches your automatic paging but with different sized OutputAreas on different pages. For us we just have one big chunk of HTML and rely on automatic paging. HtmlToPdf.ConvertHtml(html2, doc) In the example there is html1 and html2.
