Пример #1
0
        //------------------------------------------------------
        //
        //  Public Operators
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private DocumentPage GetDocumentPage(FixedPage page)
        {
            Invariant.Assert(page != null);

            DocumentPage docPage = null;
            PageContent  content = page.Parent as PageContent;

            if (content != null)
            {
                FixedDocument document = content.Parent as FixedDocument;

                // If the document is part of a FixedDocumentSequence then we want to get the
                // FixedDocumentSequenceDocumentPage for the FixedPage (cause its TextView is
                // the one we want to use).
                FixedDocumentSequence sequence = document.Parent as FixedDocumentSequence;
                if (sequence != null)
                {
                    docPage = sequence.GetPage(document, document.GetIndexOfPage(page));
                }
                else
                {
                    docPage = document.GetPage(document.GetIndexOfPage(page));
                }
            }
            return(docPage);
        }
Пример #2
0
        public IActionResult OnGetRead(int?pageNumber)
        {
            string        filePath = Path.Combine(_hostingEnvironment.WebRootPath, "sample.pdf");
            FileStream    stream   = new FileStream(filePath, FileMode.Open, FileAccess.Read);
            JsonResult    jsonResult;
            FixedDocument doc = FixedDocument.Load(stream);

            if (pageNumber == null)
            {
                jsonResult = new JsonResult(doc.ToJson());
            }
            else
            {
                jsonResult = new JsonResult(doc.GetPage((int)pageNumber));
            }

            return(jsonResult);
        }
        // Token: 0x06007BD5 RID: 31701 RVA: 0x0022CED0 File Offset: 0x0022B0D0
        private DocumentPage GetDocumentPage(FixedPage page)
        {
            Invariant.Assert(page != null);
            DocumentPage result      = null;
            PageContent  pageContent = page.Parent as PageContent;

            if (pageContent != null)
            {
                FixedDocument         fixedDocument         = pageContent.Parent as FixedDocument;
                FixedDocumentSequence fixedDocumentSequence = fixedDocument.Parent as FixedDocumentSequence;
                if (fixedDocumentSequence != null)
                {
                    result = fixedDocumentSequence.GetPage(fixedDocument, fixedDocument.GetIndexOfPage(page));
                }
                else
                {
                    result = fixedDocument.GetPage(fixedDocument.GetIndexOfPage(page));
                }
            }
            return(result);
        }