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

Encode a text using the vertical type of the font in the attachment, which succeeded in version 2.0.12 but failed in version 2.0.19

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      ARIALUNI.TTF Test1.javaARIALUNI.TTF^^

      Run the follows code use 2.0.12, the text can be successfully encoded. Run this code use 2.0.19, the text can't be encoded.

       public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException { System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");  PDDocument doc = new PDDocument();     PDPage page = new PDPage(PDRectangle.A4);     doc.addPage(page);
           File file = new File("ARIALUNI.TTF");     PDType0Font ttFont = PDType0Font.loadVertical(doc, file);          PDPageContentStream contentStream1 = new PDPageContentStream(doc, page);          contentStream1.beginText();     contentStream1.newLineAtOffset(100, 100);
           String text = "电信";     if(isCharacterEncodeable(text, ttFont))     {         contentStream1.setFont(ttFont, 12);         contentStream1.showText(text);     }     contentStream1.endText();     contentStream1.close();          doc.save("export.pdf");
           doc.close();  System.out.println("aaaaa"); }  private static boolean isCharacterEncodeable(String text, PDFont font){ try { font.encode(text); return true; } catch (Exception e) { return false; } }
      

      Attachments

        1. ARIALUNI.TTF
          22.20 MB
          bai yuan
        2. Test1.java
          3 kB
          bai yuan

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tilman Tilman Hausherr
            berylbai bai yuan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment