Ejemplo n.º 1
0
        // Methods
        internal CoreDocument(string fileName, DocOpenMode mode, FileShare shareMode, string header, IExternalStreamHandler extHandler, ISecurityHandler secHandler)
        {
            string text1;

            string[] textArray1;
            this.mParser        = null;
            this.mStream        = null;
            this.mXRef          = new ArrayList();
            this.mTrailer       = null;
            this.mRoot          = null;
            this.mInfo          = null;
            this.mSecHandler    = null;
            this.mExtHandler    = null;
            this.mToSaveQueue   = null;
            this.mIndirects     = null;
            this.mEncrypt       = null;
            this.mEncryption    = null;
            this.mWriter        = null;
            this.mPrevStartXRef = ((long)-1);
            this.mPath          = null;
            try
            {
                this.mPath        = fileName;
                this.mShareMode   = shareMode;
                this.mIndirects   = new CoreIndirectCollection(this);
                this.mFileName    = fileName;
                this.mDocOpenMode = mode;
                this.mHeader      = header;
                this.mSecHandler  = secHandler;
                this.mExtHandler  = extHandler;
                if ((mode & DocOpenMode.Read) != 0)
                {
                    this.ReadFile();
                }
                if ((mode & DocOpenMode.Create) != 0)
                {
                    this.Create();
                    text1               = Encoding.ASCII.GetString(this.GenerateFileId(fileName));
                    textArray1          = new string[2];
                    textArray1[0]       = text1;
                    textArray1[1]       = text1;
                    this.mTrailer["ID"] = PDF.O(textArray1);
                }
                this.mIndirects.UpdateIndirectCount();
                if (this.Init())
                {
                    return;
                }
                throw new PDFException("Error openning document");
            }
            catch
            {
                try
                {
                    if (this.mStream != null)
                    {
                        this.mStream.Close();
                    }
                }
                catch
                {
                }
                throw;
            }
        }
Ejemplo n.º 2
0
 protected override Document _OpenDocument(string fileName, DocOpenMode mode, FileShare shareMode, string header, IExternalStreamHandler extHandler, ISecurityHandler secHandler)
 {
     return(new CoreDocument(fileName, mode, shareMode, header, extHandler, secHandler));
 }
Ejemplo n.º 3
0
 public static Document OpenDocument(string fileName, DocOpenMode mode, FileShare shareMode, string header, IExternalStreamHandler extHandler, ISecurityHandler secHandler)
 {
     return(Library.Instance._OpenDocument(fileName, mode, shareMode, header, extHandler, secHandler));
 }
Ejemplo n.º 4
0
 protected abstract Document _OpenDocument(string fileName, DocOpenMode mode, FileShare shareMode, string header, IExternalStreamHandler extHandler, ISecurityHandler secHandler);
Ejemplo n.º 5
0
 public static Document OpenDocument(string fileName, DocOpenMode mode, FileShare shareMode, string header, IExternalStreamHandler extHandler)
 {
     return(Library.OpenDocument(fileName, mode, shareMode, header, extHandler, null));
 }