Another encoding question

  • Morgan Belford

    Morgan Belford - 2010-03-28

    I am hoping to use simple western-european accented characters (like umlaut in German) without using the approach of the Unicode sample. Should I be able to output strings like "dürfen nicht der Öffentlichkeit zugänglich gemacht," with just a StandardType1Font of Times or Helvetica? It seems like those characters are part of ISO-8859-1, but when I generate the PDF, I just get square boxes instead of the correct accented characters.

  • Stefano Chizzolini


    you're right: PDF Clown's current version (0.0.7) applies the implicit encoding (StandardEncoding), which excludes dieresis/umlaut characters (see PDF:1.6:D.1).
    Next release (0.0.8 - see ) will apply the explicit western-european equivalent encoding (WinAnsiEncoding), so it will work as expected - in the meantime you may apply a simple workaround: get your font's object and set its encoding attribute, like this:

    Font myFont = new StandardType1Font(document,StandardType1Font.FamilyEnum.Times,false,false);
    PdfDictionary myFontDictionary = myFont.getBaseDataObject();

    Hope this helps!

  • Morgan Belford

    Morgan Belford - 2010-04-18

    Thanks! That is just what I needed.

    I am actually running your code on an android device (with a few simple replacements for some of the 2D stuff that Android does differently).  I look forward to your update.

  • redskate

    redskate - 2014-08-12

    Hi Stefano - my CONGRATULATIONS and COMPLIMENTS for the excellent lib!!!!
    I could install and compile your lib and run it and does fairly well :)
    My use case is a PDF highlighter.

    Now the boring details:
    1) I need German/French words to be highlighted. On words with dieresis I get no annotation (on words without dieresis everything is fine) - do I have to enlarge somehow the StandardEncoding() ?
    2) I would like to make some minimal changes - for instance the color of highlighting (Class TextMarkup, method setMarkupType()) - here I just modified one line of Method setMarkupType() in order to have another markup color for "highlight". After Jar building and use in the actual program: no changes seemed to have taken place.

    Whan can I do please in order to solve 1) and 2) ?

    Thank you very much in advance
    Fabio (un connazionale)


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks