Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) iText 5.0.6 was released today with a major overhaul to the HTML->PDF conversion code. I suggest you try the new code instead.</p> <p>2) I'm almost positive that setting the directContent like that won't affect the pdf content generated by HTMLWorker. I'm 99% sure that it'll [re]set the font before it draws any text.</p> <p>3) Try wrapping your string in <code>&lt;font face="AFontThatActuallyContainsThoseCharacters"&gt;</code> tags. I seriously doubt the default font HTMLWorker picks will be up for the job. </p> <p>Nope. The default is Helvetica with WinAnsiEncoding. Definitely not suitable to anything outside typical English/German/French/Spanish. </p> <p>You should be able to use <code>HTMLWorker.setStyleSheet</code> to set some friendlier defaults. You'll want to set the "face" and "encoding" to something more Polish-Friendly. I recommend "Identity-H" for the encoding, which gives access to all characters in the font you go with, regardless of language. For a font, there's a program called "charmap.exe" in windows since WayBack that will show you which characters a font has available in a given encoding (including unicode). The "Arial" family looks good, as do several others.</p> <hr> <p>"the new code" probably won't change any behavior you're seeing. It's a refactoring to make future (next release as I understand it) changes easier.</p> <p>My suggestion is to go with <code>setStyleSheet()</code>:</p> <pre><code> // step 3: we create a worker parse the document HTMLWorker worker = new HTMLWorker(document); StyleSheet sheet = new StyleSheet; HashMap&lt;String, String&gt; styleMap = new HashMap&lt;String, String&gt;(); styleMap.put("face", "Arial"); // default font styleMap.put("encoding", "Identity-H"); // default encoding String tags[] = {"p", "div", ...}; for (String tag : tags) { sheet.applyStyle( tag, styleMap ); } </code></pre> <p>I'm not sure, but you might be able to just <code>applyStyle("body", styleMap)</code> and have it cascade down into everything it contains, but I'm not sure. I'm also not sure that this would address your 1-line-test as there are no tags involved. IIRC, we build a body tag if there isn't one, but I'm not at all sure.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload