Invoice
+ + +From / विक्रेता seller addr gstin |
+ Bill to / ग्राहक buyer addr gstin |
+
| Item / तपशील | Qty | Rate | Amount / रक्कम |
|---|---|---|---|
| item | +1 | +1 | +1 | +
| Subtotal / उपबेरीज | 0 |
| CGST 9% + SGST 9% / कर | 0 |
| Total / एकूण | 0 |
note
+ + diff --git a/pdf-invoice/src/test/java/com/ankurm/pdfinvoice/GlyphCountTest.java b/pdf-invoice/src/test/java/com/ankurm/pdfinvoice/GlyphCountTest.java new file mode 100644 index 0000000..580258c --- /dev/null +++ b/pdf-invoice/src/test/java/com/ankurm/pdfinvoice/GlyphCountTest.java @@ -0,0 +1,114 @@ +package com.ankurm.pdfinvoice; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.cos.COSString; +import org.apache.pdfbox.pdfparser.PDFStreamParser; +import org.apache.pdfbox.cos.COSArray; +import org.apache.pdfbox.cos.COSBase; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * A number behind "it looks right": a shaper replaces several code points with one glyph (a conjunct such as + * ज्ञ is ज + virama + ञ in the text, one glyph on the page). Count the glyph codes each engine writes into the + * page content streams for the probe invoice and compare them with the number of code points drawn. + * All fonts are Identity-H, so every string operand is 2 bytes per glyph. + */ +@SpringBootTest +class GlyphCountTest { + + @Autowired + List