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

PDF files with unusual Japanese font can not be rewrite correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8.5, 1.8.6, 2.0.0
    • 1.8.6, 2.0.0
    • None
    • Windows 7 32bit

    Description

      While rotate attached pdf file, The Japanese characters cannot display in the output pdf file.
      This problem can also occur when marge PDF files.
      We suspect that this caused by the name of font type.

      Environment
      -------------------------------------------------
      OS : Windows 7 (32bit)
      jvm : 1.6
      pdfbox: 1.8.5
      -------------------------------------------------

      Code to reproduce the problem
      -------------------------------------------------
      public static void main(String[] args) {

      String filePath = "D:\\test
      landscape.pdf";
      String newPDFFile = "D:\\test
      new_landscape.pdf";

      try {
      PDDocument rotatedDocument = PDDocument.load(filePath);
      PDDocument document = new PDDocument();

      int pageNumber = document.getNumberOfPages();
      for (int i=0; i<pageNumber; i++)

      { PDPage page = (PDPage)document.getDocumentCatalog().getAllPages().get(i); page.setRotation(-90); rotatedDocument.addPage(page); }

      rotatedDocument.save(newPDFFile);

      document.close();
      rotatedDocument.close();
      } catch (Exception e)

      { e.printStackTrace(); }

      }
      -------------------------------------------------

      Attachments

        1. font_screenshot1.png
          30 kB
          Tilman Hausherr
        2. landscape.pdf
          8 kB
          May Yu
        3. pdf_property.png
          110 kB
          May Yu

        Activity

          People

            tilman Tilman Hausherr
            May 2014 May Yu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: