private void CheckInContentStream(PdfObject @object) { String byteContent = PdfACheckerTestUtils.GetStreamWithValue(@object); byte[] newContent = byteContent.GetBytes(System.Text.Encoding.UTF8); PdfStream stream = new PdfStream(newContent); pdfA1Checker.CheckContentStream(stream); }
private void CheckInShadingPattern(PdfObject @object) { String newContentString = PdfACheckerTestUtils.GetStreamWithValue(@object); byte[] newContent = newContentString.GetBytes(System.Text.Encoding.UTF8); PdfStream stream = new PdfStream(newContent); PdfPattern pattern = new PdfPattern.Shading(stream); pdfA1Checker.CheckPdfObject(pattern.GetPdfObject()); }
private void CheckInFormXObject(PdfObject @object) { String newContentString = PdfACheckerTestUtils.GetStreamWithValue(@object); byte[] newContent = newContentString.GetBytes(System.Text.Encoding.UTF8); PdfStream stream = new PdfStream(newContent); PdfXObject xobject = new PdfFormXObject(stream); pdfA1Checker.CheckFormXObject(xobject.GetPdfObject()); }
private void CheckInTilingPattern(PdfObject @object) { String newContentString = PdfACheckerTestUtils.GetStreamWithValue(@object); byte[] newContent = newContentString.GetBytes(System.Text.Encoding.UTF8); PdfPattern pattern = new PdfPattern.Tiling(200, 200); ((PdfStream)pattern.GetPdfObject()).SetData(newContent); Color color = new PatternColor(pattern); pdfA1Checker.CheckColor(color, new PdfDictionary(), true, null); }
private void CheckInType3Font(PdfObject @object) { String newContentString = PdfACheckerTestUtils.GetStreamWithValue(@object); byte[] newContent = newContentString.GetBytes(System.Text.Encoding.UTF8); PdfFont font = PdfFontFactory.CreateType3Font(null, true); PdfDictionary charProcs = new PdfDictionary(); charProcs.Put(PdfName.A, new PdfStream(newContent)); PdfDictionary dictionary = font.GetPdfObject(); dictionary.Put(PdfName.Subtype, PdfName.Type3); dictionary.Put(PdfName.CharProcs, charProcs); pdfA1Checker.CheckFont(font); }
public virtual void LongStringInContentStreamTest() { NUnit.Framework.Assert.That(() => { pdfA2Checker.SetFullCheckMode(true); int maxAllowedLength = pdfA2Checker.GetMaxStringLength(); int testLength = maxAllowedLength + 1; NUnit.Framework.Assert.AreEqual(testLength, 32768); PdfString longString = PdfACheckerTestUtils.GetLongString(testLength); String newContentString = PdfACheckerTestUtils.GetStreamWithValue(longString); byte[] newContent = newContentString.GetBytes(System.Text.Encoding.UTF8); PdfStream stream = new PdfStream(newContent); // An exception should be thrown as content stream has a string which // is longer then it is allowed per specification pdfA2Checker.CheckContentStream(stream); } , NUnit.Framework.Throws.InstanceOf <PdfAConformanceException>().With.Message.EqualTo(PdfAConformanceException.PDF_STRING_IS_TOO_LONG)) ; }