iTextSharp.text.pdf.CMapAwareDocumentFont.GetWidth C# (CSharp) Метод

GetWidth() публичный Метод

public GetWidth ( int char1 ) : int
char1 int
Результат int
        public override int GetWidth(int char1)
        {
            if (char1 == ' ')
                return spaceWidth;
            return base.GetWidth(char1);
        }

Usage Example

        virtual public void TestWidths() {
            PdfReader pdfReader = TestResourceUtils.GetResourceAsPdfReader(TEST_RESOURCES_PATH, "fontwithwidthissue.pdf");

            try {
                PdfDictionary fontsDic = pdfReader.GetPageN(1).GetAsDict(PdfName.RESOURCES).GetAsDict(PdfName.FONT);
                PRIndirectReference fontDicIndirect = (PRIndirectReference) fontsDic.Get(new PdfName("F1"));

                CMapAwareDocumentFont f = new CMapAwareDocumentFont(fontDicIndirect);
                Assert.IsTrue(f.GetWidth('h') != 0, "Width should not be 0");
            }
            finally {
                pdfReader.Close();
            }
        }