Example #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// DocumentReader
        ///
        /// <summary>
        /// Initializes a new instance of the DocumentReader class
        /// with the specified arguments.
        /// </summary>
        ///
        /// <param name="src">Path of the PDF file.</param>
        /// <param name="password">Password query.</param>
        /// <param name="fullaccess">Requires full access.</param>
        /// <param name="partial">Partial reading mode.</param>
        /// <param name="io">I/O handler.</param>
        ///
        /* ----------------------------------------------------------------- */
        public DocumentReader(string src, IQuery <string> password,
                              bool fullaccess, bool partial, IO io) : base(io)
        {
            Debug.Assert(io != null);
            _core = ReaderFactory.Create(src, password, fullaccess, partial, out string result);
            Debug.Assert(_core != null);

            var f = io.GetPdfFile(src, result);

            f.Count      = _core.NumberOfPages;
            f.FullAccess = _core.IsOpenedWithFullPermissions;

            File        = f;
            Metadata    = _core.GetMetadata();
            Encryption  = _core.GetEncryption(f);
            Pages       = new ReadOnlyPageList(_core, f);
            Attachments = new AttachmentCollection(_core, f, IO);
        }
Example #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// DocumentReader
        ///
        /// <summary>
        /// Initializes a new instance of the DocumentReader class
        /// with the specified arguments.
        /// </summary>
        ///
        /// <param name="src">Path of the PDF file.</param>
        /// <param name="qv">Password query or string.</param>
        /// <param name="fullaccess">Requires full access.</param>
        /// <param name="partial">Partial reading mode.</param>
        /// <param name="io">I/O handler.</param>
        ///
        /* ----------------------------------------------------------------- */
        private DocumentReader(string src,
                               QueryMessage <IQuery <string, string>, string> qv,
                               bool fullaccess,
                               bool partial,
                               IO io
                               ) : base(io)
        {
            _core = ReaderFactory.Create(src, qv, fullaccess, partial);

            var f = io.GetPdfFile(src, qv.Value);

            f.Count      = _core.NumberOfPages;
            f.FullAccess = _core.IsOpenedWithFullPermissions;

            File        = f;
            Metadata    = _core.GetMetadata();
            Encryption  = _core.GetEncryption(f);
            Pages       = new ReadOnlyPageList(_core, f);
            Attachments = new AttachmentCollection(_core, f, IO);
        }