|
Rank: Member Groups: Member
Joined: 5/8/2012 Posts: 13
|
Hi, I am trying to prevent the ASPXToPDF control from page breaking in the middle of and an asp panel. I tried adding the css style 'page-break-inside:avoid' to the asp panel, as well as adding it to a nested div. Neither one seems to be working. Initially, I was using EO.PDF.dll version 3.0.124.2, but have just upgraded to 4.0.41.2. It didn't do anything but break my license and start stamping the watermark on my PDFs again. Now I am back on version 3. Thanks in advance. Adam
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You will want to check your page contents to find out the root cause. "page-break-inside: avoid" does not guarantee a block will not be split into multiple pages. For example, if you have multiple conflicting instructions (for example, if you have a page-break-after:always" inside a "page-break-inside:void"), then one of them will win and another one will lose. Also if the block is bigger than one page, then it will over flow to multiple page regardless. So you will want to dig into your HTML to find out why.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 5/8/2012 Posts: 13
|
Thanks for the quick reply. It mysteriously started working. I imagine that my style sheet was cached. Now it is page-breaking like it should be. However, it is not converting with a margin at the top of the second page (after the page-break). Is there anything special that I have to do to get that to work? I have the following code in my CSS file, which works find when printing a page. It just doesn't work when converting to PDF.
What are your recommendations for this?
@page { size:8.5in 11in; margin-top: 3cm; }
Thanks,
Adam
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, You won't be able to control page size and margin with CSS. The HTML to PDF converter renders the HTML in "display" mode, not "printing" mode. So it does not recongize any printing related CSS, nor will the output matches your printing output. See here for more information on how to set page output size and margins: http://www.essentialobjects.com/doc/4/htmltopdf/page_size.aspxThanks!
|
|
Rank: Member Groups: Member
Joined: 5/8/2012 Posts: 13
|
Wow. I should have figure that out a long time ago. Thanks a lot for your help. You guys are awesome. Adam
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
You are very welcome. Please feel free to let us know if there is anything else.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 5/8/2012 Posts: 13
|
I hate to open this thread back up, but I am having the issue again. I initially thought that I had the problem resolved, but it turns out it the sections that were printing were sized just well enough to trick me into thinking it was working. Do you know if the HTMLToPDF control is doing something special with that css style, because it doesn't look like the page-break-inside style is supported in all browsers. In fact, according to W3Schools, it is only supported in Opera. I am not sure if I am chasing my tail and never going to get this because it's not supported in the browsers I am using, or maybe there is something else that I am missing. I have checked all of the inherited CSS and nothing should be overriding this style. Please Help. Thanks, Adam
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, We do a lot of special things with these paging CSS styles. :) You can find the full reference here: http://www.essentialobjects.com/doc/4/htmltopdf/paging.aspxThose CSS are just "suggestions" and no main stream browsers take them seriously --- and even if they do, different browsers may interpret it differently as the standard did not clearly define the behavior for these properties (for example, should a "page-break-after: always" cut a picture or not?). In short, browsers do not care much about paging behaviors because their main goal is to display the page right on the screen. On the other hand, we do take these CSS styles seriously and that's what you would use to explicitly instruct our converter on how to page contents. This is necessary because our main goal is to create a PDF file, which naturally needs to be paged properly. As such you should not confuse our paging behavior with a browser's paging behavior ----- they will never be the same. Or you can pretty much think it this way: the browser's paging behavior almost has nothing to do with our paging behavior. Thus in order to find out exactly what's causing the problem with you, you will have to play with your HTML. Try to comment contents out block by block and you should be able to find out what's causing it. Thanks!
|
|