iTextSharp.text.pdf.RandomAccessFileOrArray.Close C# (CSharp) Метод

Close() публичный Метод

public Close ( ) : void
Результат void
        public void Close()
        {
            isBack = false;
            if (rf != null) {
                rf.Close();
                rf = null;
            }
        }

Usage Example

Пример #1
0
        public static void SavePageAllImages(string filePath, string finalPath, int pageIndex)
        {
            RandomAccessFileOrArray raf = new iTextSharp.text.pdf.RandomAccessFileOrArray(filePath);
            var pdf = Load(filePath);

            try
            {
                PdfDictionary pg = pdf.GetPageN(pageIndex);

                // recursively search pages, forms and groups for images.
                PdfObject obj = FindImageInPDFDictionary(pg);
                if (obj != null)
                {
                    int       XrefIndex = ((PRIndirectReference)obj).Number;
                    PdfObject pdfObj    = pdf.GetPdfObject(XrefIndex);
                    PdfStream pdfStrem  = (PdfStream)pdfObj;
                    byte[]    bytes     = PdfReader.GetStreamBytesRaw((PRStream)pdfStrem);
                    if ((bytes != null))
                    {
                        String imageFileName = System.IO.Path.Combine(finalPath, Guid.NewGuid().ToString() + ".png");

                        File.WriteAllBytes(imageFileName, bytes);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                pdf.Close();
                raf.Close();
            }
        }
All Usage Examples Of iTextSharp.text.pdf.RandomAccessFileOrArray::Close