public virtual void NotReuseIndirectRefForObjectStreamTest() { String inputFile = sourceFolder + "notReuseIndirectRefForObjectStream.pdf"; String outputFile = destinationFolder + "adjustingsInObjStm.pdf"; PdfDocument pdfDoc = new PdfDocument(new PdfReader(inputFile), new PdfWriter(outputFile).SetCompressionLevel (CompressionConstants.NO_COMPRESSION)); PdfArray media = pdfDoc.GetPage(1).GetPdfObject().GetAsArray(PdfName.MediaBox); media.Remove(2); media.Add(new PdfNumber(500)); media.SetModified(); pdfDoc.Close(); PdfDocument doc = new PdfDocument(new PdfReader(sourceFolder + "adjustingsInObjStm.pdf")); PdfObject @object = doc.GetPdfObject(8); PdfDictionary pageDict = (PdfDictionary)@object; int expectNumberOfObjects = pdfDoc.GetNumberOfPdfObjects(); //output pdf document should be openable NUnit.Framework.Assert.AreEqual(10, expectNumberOfObjects); NUnit.Framework.Assert.AreEqual(PdfName.ObjStm, pageDict.Get(PdfName.Type)); }