Welcome Guest Search | Active Topics | Sign In | Register

Text is splitting when going onto the next line Options
Aaron
Posted: Friday, August 31, 2018 9:41:59 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
When creating a pdf with the style
@page {
size: a4 portrait;
margin: 12mm 0;
display: inline-block;
}

and then adding a large amount of text in a section (which has a style of inline-block and a page break of before and after) the text is splitting in half at the bottom of a page. There is no padding on the section but there is on the p tags

example image - https://imgur.com/a/9UKCdsm


this looks like it may be a bug


eo_support
Posted: Friday, August 31, 2018 12:34:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

We only have limited support for @page style. @page style is supported as follow:

1. If HtmlToPdfOptions.UsePrintMedia is false (by default), then @page style is ignored;
2. If HtmlToPdfOptions.UsePrintMedia is true and you did not explicitly specify HtmlToPdfOptions.PageSize, then the size and margin defined in your @page style is used;

Particularly, you should NOT use any attribute that may affect the page layout in your @page style. In your case, it means you should remove display:inline-block from your @page style. EO.Pdf does not page output the same way as the browser engine does, instead it relies on the browser engine renders the whole page in a single continuous "long" page and then "cut" it into multiple pages. So you should avoid using any attributes that causes the browser engine to precut the initial long page before it is passed down to EO.Pdf.

If you still have problems after that, you can send us a test HTML and we will be happy to investigate further. See here for more information on how to send test files to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
Aaron
Posted: Monday, September 3, 2018 5:40:28 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
I have just sent you an email of the code. I have stripped out pretty much all css apart from essentials and the text is still splitting over 2 pages

eo_support
Posted: Monday, September 3, 2018 6:33:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

We tested your code here with the latest build (2018.2.74) and we do not see any problems. Here are our steps:

1. Unzip the file you sent to us;
2. Copy the CSS file into the same directory as in the .cshtml file;
2. Modified the style sheet link's href to the CSS file directly;
3. Renamed the file from .cshtml to .html;
4. Enter the full path of the .html file into our EOPdfDemo application's Demos -> HTMl to PDF -> Basic -> Convert Url demo. Run the demo;

We do not see any text cutting in the result PDF file.

Please try the same steps and see if you see any problems. If you do not see any problems, then the problem must be related to something in your project. In that case please try to send us a test project that we can run as is without any modification. This is extremely important because we can't troubleshoot a problem we can not see. So the first step is always to reproduce the problem.

Thanks!
Aaron
Posted: Tuesday, September 4, 2018 11:41:28 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
turns out it was due to a fix for page-break-inside: avoid

so once I got rid of the css below it worked
body > * { width: 99.999%; zoom: .999; }

thanks for your help
eo_support
Posted: Tuesday, September 4, 2018 8:45:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Great. Glad that you found out the root cause!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.