iTextSharp.text.pdf.PdfDictionary.GetAsStream C# (CSharp) Method

GetAsStream() public method

public GetAsStream ( PdfName key ) : PdfStream
key PdfName
return PdfStream
        public PdfStream GetAsStream(PdfName key)
        {
            PdfStream stream = null;
            PdfObject orig = GetDirectObject(key);
            if (orig != null && orig.IsStream())
                stream = (PdfStream) orig;
            return stream;
        }

Usage Example

示例#1
0
        protected override void ReadColorProfile()
        {
            PdfObject outputIntents = reader.Catalog.GetAsArray(PdfName.OUTPUTINTENTS);

            if (outputIntents != null && ((PdfArray)outputIntents).Size > 0)
            {
                PdfStream iccProfileStream = null;
                for (int i = 0; i < ((PdfArray)outputIntents).Size; i++)
                {
                    PdfDictionary outputIntentDictionary = ((PdfArray)outputIntents).GetAsDict(i);
                    if (outputIntentDictionary != null)
                    {
                        PdfName gts = outputIntentDictionary.GetAsName(PdfName.S);
                        if (iccProfileStream == null || PdfName.GTS_PDFA1.Equals(gts))
                        {
                            iccProfileStream = outputIntentDictionary.GetAsStream(PdfName.DESTOUTPUTPROFILE);
                            if (iccProfileStream != null && PdfName.GTS_PDFA1.Equals(gts))
                            {
                                break;
                            }
                        }
                    }
                }
                if (iccProfileStream is PRStream)
                {
                    colorProfile = ICC_Profile.GetInstance(PdfReader.GetStreamBytes((PRStream)iccProfileStream));
                }
            }
        }
All Usage Examples Of iTextSharp.text.pdf.PdfDictionary::GetAsStream