示例#1
0
        public File(
      IInputStream stream
      )
        {
            Initialize();

              reader = new Reader(stream, this);

              Reader.FileInfo info = reader.ReadInfo();
              version = info.Version;
              trailer = PrepareTrailer(info.Trailer);
              if(trailer.ContainsKey(PdfName.Encrypt)) // Encrypted file.
            throw new NotImplementedException("Encrypted files are currently not supported.");

              indirectObjects = new IndirectObjects(this, info.XrefEntries);
              document = new Document(trailer[PdfName.Root]);
              document.Configuration.XrefMode = (PdfName.XRef.Equals(trailer[PdfName.Type])
            ? Document.ConfigurationImpl.XRefModeEnum.Compressed
            : Document.ConfigurationImpl.XRefModeEnum.Plain);
        }
示例#2
0
        public void Dispose(
      )
        {
            if(reader != null)
              {
            reader.Dispose();
            reader = null;

            /*
              NOTE: If the temporary file exists (see Save() method), it must overwrite the document file.
            */
            if(System.IO.File.Exists(TempPath))
            {
              System.IO.File.Delete(path);
              System.IO.File.Move(TempPath,path);
            }
              }

              GC.SuppressFinalize(this);
        }