Welcome Guest Search | Active Topics | Sign In | Register

line/element spacing in pdf file Options
Becky
Posted: Thursday, May 24, 2012 8:17:37 PM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Hi again,
I have one more question. We are trying to create a pdf document with very specific column and spacing requirements. Sections contain headings. A section starts on a new page with a title/heading that is centered across the whole document. Thereafter, the section is divided into 2 columns. The first column should take up about 2/3 of the page and contain the body of the heading. The second column should take up about 1/3 of the page and contains the heading. The columns are separated by a vertical line. Both columns should start on the same horizontal line. There should be no vertical space between the section title and the first heading.

I have created a page that has two buttons at this url:http://pakatrak.ipower.com/2009_HRDirector/ConvertwithEO.aspx

if you click the 'convert PolicyDemo with EO' button you will see how essential objects is converting the htm file. If you click the 'convert PolicyDemo with Winnovative' you will see how I want the columns to line up.

I do not want 'Introduction to Manual' to be on a page by itself, I want it to be the line above the rest of the document. And - I want the text for 'Introduction to Policies to start on the same line as the heading called 'Introduction to Policies'. Currently it is on the second line.

I have tried quite a few of the html to pdf converters that I could find online. Pretty much all of the demos will convert the html to pdf with the spacing and lines that I want. I don't mind changing the html, I create it through my code. I just need to know what to change it to in order to make it line up correctly.

The htm file can be found at http://pakatrak.ipower.com/2009_HRDirector/html/PolicyDemo.htm
and the css file can be found at http://pakatrak.ipower.com/2009_HRDirector/html/BEPolicyStyle.css

Thanks for any input you can give me on this issue.

P.S. I love the speed and cleanliness of your product. I just need to work out the minor details.

Becky
eo_support
Posted: Thursday, May 24, 2012 8:49:48 PM
Rank: Administration
Groups: Administration

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

We are not able to reproduce the first problem. We ran the PolicyDemo.html through our demo application and it worked fine. So your application might have set some other settings that we are not aware of, you can try to write a small sample application to demonstrate the problem and post the source code here. We will then run it here to see if we can see the same problem.

As for the second problem, you can try to adjust the padding top of your "Introduction to Manual" text block to push it down. For example, instead of using:

<p>Introduction to Manual</p>

You can use:

<div style="padding-top:10px;">
<p>Introduction to Manual</p>
</div>

To push it down 10 pixels. This way you can fine tune the position of the text.

Our rendering is mostly close to Google Chrome. So you can use Chrome to verify the output while fine tuning your HTML.

BTW: We have already fixed the bulleting problem. We are packing it up and should be able to post the update tonight. We will reply your other thread again once the download page is updated.

Thanks!
eo_support
Posted: Thursday, May 24, 2012 10:41:23 PM
Rank: Administration
Groups: Administration

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

We were able to reproduce the first problem. The root of the first problem is you have the following CSS rule in your CSS file:

Code: CSS
div
{
    page-break-inside: avoid;
}


When this rule is present and the page has a DIV that won't fit in the current page, the whole DIV will be moved to the next page. This occurred for your file on the first page since the whole remaining content except for the title, from "his manual serves as ..." to "If you have any questions,...." is in a single DIV with "page-break-inside: avoid". When our converter tries to honor page-break-inside: avoid, it is unable to do so on the first page. So it moved the whole block to the second page.

I am not sure whether Winnovative has the same paging policy as we do; However even if they do have the same policy, the would not run into this problem because their default page margin is smaller than ours, thus give the page enough room to fit the whole block.

Reducing page margins can be a valid workaround for you. See here for more information on how to set page size and margin:

http://www.essentialobjects.com/doc/4/htmltopdf/page_size.aspx

I would also suggest you to adjust your CSS rules. "div { page-break-inside: avoid; }" is probably too broad.

Hope this resolves the problem for you. Please let us know if you have any more questions.

Thanks!
Becky
Posted: Friday, May 25, 2012 11:12:15 AM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Thanks - the page size fixed the title being on a page by itself. I also took out the page-break-inside: avoid; in the css.

As for the other problem. You put me on the right track of where to look. I think your converter is more precise (which is good).

I am drawing the vertical line by showing the right border of anything with id="column_left"

I am also putting <p> around all paragraphs within the <div> of id="column_left"

the <p> has a top margin of 10px

The <div> marked with id="column_right" did not have a <p> around the heading.

When I added the <p> tag around the headings it moved them down to match the body on the left.

Mostly I want them to line up so what I have now will work.

But ideally - I would like them both to start right where the line(border) starts without the margin on the top. If I set margin-top for all <p> to 0 then of course this takes the spacing out of my paragraphs. Can you think of any other way to do this?

Not a huge deal, just wondered if you could think of anything.

You guys are great to work with - Thank You!
Becky
eo_support
Posted: Friday, May 25, 2012 11:33:38 AM
Rank: Administration
Groups: Administration

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

You are very wecome! Glad to hear that you like to work with us.

You probably have to modify the margin-top one way or another. By default a p element carries a margin top and a margin bottom --- in fact that's pretty much the only difference between a p and a div. All browsers recognize this difference. Because our goal is to render everything exactly the same as you would see in a browser, so we have to recognize that as well. As such we cannot change our engine to take the extra margin out for the p element. I am not sure why Winnovative doesn't seem to recognize that. For us one of the principle rules is to make sure what you see in your browser is what you get in PDF ---- that way user don't have to work their page twice.

I would not recommend you to set margin-top for all p to 0 though. That's again too broad --- just like you set div { page-break-inside: avoid; }. In theory there is nothing wrong with that, but in practice, because it is too broad, it often affects things that you did't expect it to affect, thus when problem occurs it becomes much more difficult to troubleshoot. So you can probably just change the only one you want to change with inline style attributes, such as:

Code: HTML/ASPX
<p style="margin-top:0px;">
  .....This paragraph will have 0 top margin......
</p>


Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Becky
Posted: Friday, May 25, 2012 11:45:08 AM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Yes, that works perfectly now.

I am very new to css so your help is very much appreciated.

Thanks again,
Becky
eo_support
Posted: Friday, May 25, 2012 11:51:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Perfect. Please feel free to let us know if there is anything else.


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.