Exemplo n.º 1
0
        /// <summary>
        /// The assert only image and image size.
        /// </summary>
        /// <param name="reader">
        /// The reader.
        /// </param>
        /// <param name="pageNum">
        /// The page number.
        /// </param>
        /// <param name="width">
        /// The width.
        /// </param>
        /// <param name="height">
        /// The height.
        /// </param>
        private static void AssertOnlyImageAndImageSize(PdfReader reader, int pageNum, int width, int height)
        {
            PdfDictionary page       = reader.GetPageNRelease(pageNum);
            PdfDictionary resources  = page.GetAsDict(PdfName.RESOURCES);
            PdfDictionary dictionary = resources.GetAsDict(PdfName.XOBJECT);

            Assert.AreEqual(1, dictionary.Keys.Count);
            dictionary.GetEnumerator().MoveNext();
            Dictionary <PdfName, PdfObject> .Enumerator e = dictionary.GetEnumerator();
            e.MoveNext();
            PdfName   key = e.Current.Key;
            PdfStream str = dictionary.GetAsStream(key);

            Assert.AreEqual(width, str.GetAsNumber(PdfName.WIDTH).IntValue);
            Assert.AreEqual(height, str.GetAsNumber(PdfName.HEIGHT).IntValue);
        }