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

OpenType Shaping

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • FontBox, PDModel
    • All

    Description

      the problem is, in some languages letters need to be joined together for example, consider this word

      سلام

      but after creating a pdf it contorts to

      س‌ل‌ام

      with extra semi-spaces. I think this is a bug in pdfbox and definetly is not related to font.

      SampleCode.java
      public class SampleCode
      {
          public static void main(String[] args) throws IOException
          {
              
              PDDocument document = new PDDocument();
      	//this font perfectly works in iText and JasperReport with the same text
              PDFont titleFont = PDType0Font.load(document, SampleCode.class.getResourceAsStream("/BYekan.ttf"));
      
              PDPage page = new PDPage(PDRectangle.A4);
              document.addPage(page);
              PDPageContentStream contentStream = new PDPageContentStream(document, page);
      
              contentStream.beginText();
              contentStream.setFont(titleFont, 12);
              contentStream.newLineAtOffset(0, 100);
              contentStream.showText("سلام");
              contentStream.endText();
              contentStream.close();
              
            
              document.save(new File("/home/omidp/temp/htmltopdf/output.pdf"));
              document.close();
          }
      
      
      }
      

      Attachments

        1. BYekan.ttf
          47 kB
          Omid Pourhadi
        2. pdfbox.pdf
          11 kB
          John Hewson
        3. itext.pdf
          18 kB
          John Hewson

        Issue Links

          Activity

            People

              Unassigned Unassigned
              omidp Omid Pourhadi
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: