Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4116

could not add text without unicode in the font

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Minor
    • Resolution: Won't Do
    • 2.0.8
    • None
    • PDModel
    • None
    • Windows

    Description

      As shown in the debugger, that the PDFType1Font map the code of 33 to "minus", but there is no unicode value associated with it. 

      If we use the code `contentStream.showText("\u0021");` to add content, it will cause an error of following. 

      Exception in thread "main" java.lang.IllegalArgumentException: U+0021 ('exclam') is not available in this font AMZNGR+CMSY10 (generic: FREBPT+CMSY10) encoding: built-in (Type 1) with differences
      at org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:439)
      at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:323)
      at org.apache.pdfbox.debugger.CreatePDF.main(CreatePDF.java:63)

      The best way I could do is used the "appendRawCommands", but I find it's marked as deprecated. I am wondering why or is there any replacement for this function?

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            william_wang_007 xing Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: