File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -498,4 +498,35 @@ void PDFBOX5920TrueType() throws IOException
498498 assertEquals (278.0f , font .getSpaceWidth ());
499499 }
500500 }
501+
502+ @ Test
503+ void testSymbol () throws IOException
504+ {
505+ ByteArrayOutputStream baos = new ByteArrayOutputStream ();
506+ try (PDDocument doc = new PDDocument ())
507+ {
508+ PDPage page = new PDPage ();
509+ try (PDPageContentStream contentStream = new PDPageContentStream (doc , page ))
510+ {
511+ PDType1Font font = new PDType1Font (FontName .SYMBOL );
512+
513+ contentStream .beginText ();
514+ contentStream .setFont (font , 10 );
515+ contentStream .newLineAtOffset (10 , 700 );
516+ // Note that the Alpha is the greek alpha, but the Omega is the Ohm symbol
517+ // (Tested on Windows)
518+ contentStream .showText ("\u0391 \u2126 " );
519+ contentStream .endText ();
520+ }
521+
522+ doc .addPage (page );
523+ doc .save (baos );
524+ }
525+ try (PDDocument doc = Loader .loadPDF (baos .toByteArray ()))
526+ {
527+ PDFTextStripper stripper = new PDFTextStripper ();
528+ String text = stripper .getText (doc );
529+ assertEquals ("\u0391 \u2126 " , text .trim ());
530+ }
531+ }
501532}
You can’t perform that action at this time.
0 commit comments