Forum › Bugs

PDF problem Generation

macki
Hi,

our team has problem with pdf generation from given html structure e.g.

<p with=lets say font 1>
<span with=font2>
</span>

<span with=font3>
<.span>
</p>

Generally we need span with different style font in one paragraph. Do you know how to solve this problem?

Details in attachment.
  1. Gabriola.ttf‎ 1.8 MB ‎
    font
  2. arial.ttf‎ 778.6 kB
  3. lineHeight2.html‎ 4.0 kB
  4. lineHeight2.pdf‎ 21.0 kB
mikeday
What is the problem?
macki
My question is how to generate proper pdf when in <P> we have many <SPAN> with different fonts and line-height?

The problem is visible e.g on file ex1.png

  1. ex1.PNG‎ 188.2 kB
  2. lineHeightMix.html‎ 3.6 kB
  3. lineHeightMix.pdf‎ 29.5 kB
mikeday
Ah the layout is different to the browser. It might help to specify a line-height on the paragraph itself.
macki
Mike we are testing this solution - the result is better but there is a still problem with text generation.

Please take look to the attachment:
- html
- pdf result
- comparison in png

Do you think it is a trivial/common problem?

  1. ex2.PNG‎ 228.3 kB
  2. lineHeightMix.html‎ 3.6 kB
  3. lineHeightMix.pdf‎ 42.2 kB
pjrm
I'm not certain of what you're trying to achieve (mikeday's guess differs from mine), but have a look at the attached file. Line spacing in CSS depends both on the line-height of the block container (the p element in this case) and the individual inline elements (the span elements in this example). If you want the spans with a small font-size to be more closely spaced than the larger spans, then you'll want to make sure that the block container has a small line-height (since every line will be at least as tall as the p's line-height); and then you'd probably want each span to have a line-height big enough to avoid overlapping neighbouring lines.

The way I've done that in the attached file is to use a simple number (rather than a length) as the value of line-height, and then each span's effective line-height will be that number multiplied by the span's font-size.

So the span with font-size:10pt (which I've made long enough to span 2 or 3 lines) is closely spaced, while any line containing a font-size:21pt span has more spacing.

Is this what you want to achieve?
  1. inline-lineHeight2.html‎ 4.4 kB
pjrm
Forgot to give a reference to the CSS description of line spacing:
http://www.w3.org/TR/CSS2/visudet.html#line-height
macki
Thanks for your answare Pjrm.

Edited by macki