iTextSharp.text.pdf.parser.ContentByteUtils.GetContentBytesForPage C# (CSharp) Method

GetContentBytesForPage() public static method

public static GetContentBytesForPage ( PdfReader reader, int pageNum ) : byte[]
reader iTextSharp.text.pdf.PdfReader
pageNum int
return byte[]
        public static byte[] GetContentBytesForPage(PdfReader reader, int pageNum)
        {
            PdfDictionary pageDictionary = reader.GetPageN(pageNum);
            PdfObject contentObject = pageDictionary.Get(PdfName.CONTENTS);
            if (contentObject == null)
                return new byte[0];

            byte[] contentBytes = ContentByteUtils.GetContentBytesFromContentObject(contentObject);
            return contentBytes;
        }

Usage Example

コード例 #1
0
        /**
         * Processes content from the specified page number using the specified listener
         * @param <E> the type of the renderListener - this makes it easy to chain calls
         * @param pageNumber the page number to process
         * @param renderListener the listener that will receive render callbacks
         * @return the provided renderListener
         * @throws IOException if operations on the reader fail
         */

        public E ProcessContent <E>(int pageNumber, E renderListener) where E : IRenderListener
        {
            PdfDictionary pageDic      = reader.GetPageN(pageNumber);
            PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);

            PdfContentStreamProcessor processor = new PdfContentStreamProcessor(renderListener);

            processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, pageNumber), resourcesDic);
            return(renderListener);
        }
All Usage Examples Of iTextSharp.text.pdf.parser.ContentByteUtils::GetContentBytesForPage