public virtual void TestPdfA3uWithNullIntent() { String testName = "testPdfA3uWithNullIntent"; String path = PdfHelper.GetDefaultImagePath(); String pdfPath = PdfHelper.GetTargetDirectory() + testName + ".pdf"; OcrPdfCreatorProperties properties = new OcrPdfCreatorProperties(); properties.SetTextColor(DeviceCmyk.BLACK); properties.SetScaleMode(ScaleMode.SCALE_TO_FIT); PdfHelper.CreatePdfA(pdfPath, new FileInfo(path), properties, null); String result = PdfHelper.GetTextFromPdfLayer(pdfPath, null); NUnit.Framework.Assert.AreEqual(PdfHelper.DEFAULT_TEXT, result); NUnit.Framework.Assert.AreEqual(ScaleMode.SCALE_TO_FIT, properties.GetScaleMode()); }
public virtual void TestInvalidFontWithInvalidDefaultFontFamily() { NUnit.Framework.Assert.That(() => { String testName = "testInvalidFontWithInvalidDefaultFontFamily"; String path = PdfHelper.GetDefaultImagePath(); String pdfPath = PdfHelper.GetTargetDirectory() + testName + ".pdf"; FileInfo file = new FileInfo(path); OcrPdfCreatorProperties properties = new OcrPdfCreatorProperties(); FontProvider pdfOcrFontProvider = new FontProvider("Font"); pdfOcrFontProvider.GetFontSet().AddFont("font.ttf", PdfEncodings.IDENTITY_H, "Font"); properties.SetFontProvider(pdfOcrFontProvider, "Font"); properties.SetScaleMode(ScaleMode.SCALE_TO_FIT); PdfHelper.CreatePdf(pdfPath, file, properties); String result = PdfHelper.GetTextFromPdfLayer(pdfPath, null); NUnit.Framework.Assert.AreEqual(PdfHelper.DEFAULT_TEXT, result); NUnit.Framework.Assert.AreEqual(ScaleMode.SCALE_TO_FIT, properties.GetScaleMode()); } , NUnit.Framework.Throws.InstanceOf <OcrException>().With.Message.EqualTo(MessageFormatUtil.Format(OcrException.CANNOT_CREATE_PDF_DOCUMENT, OcrException.CANNOT_RESOLVE_PROVIDED_FONTS))) ; }