/// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="page">The DocumentPage object for the requesed Page.</param>
 /// <param name="pageNumber">The page number of the returned page.</param>
 /// <param name="error">Error occurred during an asynchronous operation.</param>
 /// <param name="cancelled">Whether an asynchronous operation has been cancelled.</param>
 /// <param name="userState">Unique identifier for the asynchronous task.</param>
 public GetPageCompletedEventArgs(DocumentPage page, int pageNumber, Exception error, bool cancelled, object userState)
     :
     base(error, cancelled, userState)
 {
     _page = page;
     _pageNumber = pageNumber;
 }
        public override DocumentPage GetPage(int pageNumber)
        {
            // Get the requested page.
            DocumentPage page = flowDocumentPaginator.GetPage(pageNumber);

            // Wrap the page in a Visual. You can then add a transformation and extras.
            ContainerVisual newVisual = new ContainerVisual();
            newVisual.Children.Add(page.Visual);

            // Create a header. 
            DrawingVisual header = new DrawingVisual();
            using (DrawingContext context = header.RenderOpen())
            {
                Typeface typeface = new Typeface("Times New Roman");                
                FormattedText text = new FormattedText("Page " + (pageNumber + 1).ToString(),
                  CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                  typeface, 14, Brushes.Black);
                
                // Leave a quarter-inch of space between the page edge and this text.
                context.DrawText(text, new Point(96*0.25, 96*0.25));
            }
            // Add the title to the visual.
            newVisual.Children.Add(header);

            // Wrap the visual in a new page.
            DocumentPage newPage = new DocumentPage(newVisual);
            return newPage;            
        }
Example #3
0
        //--------------------------------------------------------------------
        //
        // Ctors
        //
        //---------------------------------------------------------------------

        #region Ctors
        internal FixedDocumentSequenceDocumentPage(FixedDocumentSequence documentSequence, DynamicDocumentPaginator documentPaginator, DocumentPage documentPage)
            : base((documentPage is FixedDocumentPage) ? ((FixedDocumentPage)documentPage).FixedPage : documentPage.Visual, documentPage.Size, documentPage.BleedBox, documentPage.ContentBox)
        {
            Debug.Assert(documentSequence != null);
            Debug.Assert(documentPaginator != null);
            Debug.Assert(documentPage != null);
            _fixedDocumentSequence = documentSequence;
            _documentPaginator     = documentPaginator;
            _documentPage          = documentPage;
        }
Example #4
0
        /// <summary>
        /// <see cref="DynamicDocumentPaginator.GetPagePosition"/>
        /// </summary>
        internal ContentPosition GetPagePosition(DocumentPage page)
        {
            FixedDocumentSequenceDocumentPage docPage = page as FixedDocumentSequenceDocumentPage;

            if (docPage == null)
            {
                return(ContentPosition.Missing);
            }
            return(docPage.ContentPosition);
        }
        // Token: 0x06002CC2 RID: 11458 RVA: 0x000C9E44 File Offset: 0x000C8044
        internal ContentPosition GetPagePosition(DocumentPage page)
        {
            FixedDocumentPage fixedDocumentPage = page as FixedDocumentPage;

            if (fixedDocumentPage == null)
            {
                return(ContentPosition.Missing);
            }
            return(fixedDocumentPage.ContentPosition);
        }
Example #6
0
        // Token: 0x06002B77 RID: 11127 RVA: 0x000C6614 File Offset: 0x000C4814
        internal DocumentPage GetPage(FixedDocument document, int fixedDocPageNumber)
        {
            if (fixedDocPageNumber < 0)
            {
                throw new ArgumentOutOfRangeException("fixedDocPageNumber", SR.Get("IDPNegativePageNumber"));
            }
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }
            DocumentPage page = document.GetPage(fixedDocPageNumber);

            return(new FixedDocumentSequenceDocumentPage(this, document.DocumentPaginator as DynamicDocumentPaginator, page));
        }
Example #7
0
        // Callback from inner IDP.GetPageAsync
        private void _OnGetPageCompleted(object sender, GetPageCompletedEventArgs args)
        {
            DocumentsTrace.FixedDocumentSequence.IDF.Trace(string.Format("_OnGetPageCompleted"));

            // this job is complete
            GetPageAsyncRequest completedRequest = (GetPageAsyncRequest)args.UserState;

            _pendingPages.Remove(completedRequest.Page);

            // wrap the returned result into FixedDocumentSequenceDocumentPage
            DocumentPage sdp        = DocumentPage.Missing;
            int          pageNumber = completedRequest.Page.PageNumber;

            if (!args.Cancelled && (args.Error == null) && (args.DocumentPage != DocumentPage.Missing))
            {
                sdp = new FixedDocumentSequenceDocumentPage(this, (DynamicDocumentPaginator)sender, args.DocumentPage);
                _SynthesizeGlobalPageNumber((DynamicDocumentPaginator)sender, args.PageNumber, out pageNumber);
            }

            if (!args.Cancelled)
            {
                // Notify all outstanding request for this particular page
                ArrayList notificationList = new ArrayList();
                IEnumerator <KeyValuePair <Object, GetPageAsyncRequest> > ienum = _asyncOps.GetEnumerator();
                try
                {
                    while (ienum.MoveNext())
                    {
                        GetPageAsyncRequest asyncRequest = ienum.Current.Value;

                        // Process any outstanding request for this PageContent
                        if (completedRequest.Page.Equals(asyncRequest.Page))
                        {
                            notificationList.Add(ienum.Current.Key);
                            // this could throw depending on event handlers that are added
                            _NotifyGetPageAsyncCompleted(sdp, pageNumber, args.Error, asyncRequest.Cancelled, asyncRequest.UserState);
                        }
                    }
                }
                finally
                {
                    // Remove completed requests from current async ops list
                    foreach (Object userState in notificationList)
                    {
                        _asyncOps.Remove(userState);
                    }
                }
            }
        }
Example #8
0
        // Token: 0x06002B76 RID: 11126 RVA: 0x000C65C8 File Offset: 0x000C47C8
        internal DocumentPage GetPage(int pageNumber)
        {
            if (pageNumber < 0)
            {
                throw new ArgumentOutOfRangeException("pageNumber", SR.Get("IDPNegativePageNumber"));
            }
            DynamicDocumentPaginator dynamicDocumentPaginator;
            int pageNumber2;

            if (this.TranslatePageNumber(pageNumber, out dynamicDocumentPaginator, out pageNumber2))
            {
                DocumentPage page = dynamicDocumentPaginator.GetPage(pageNumber2);
                return(new FixedDocumentSequenceDocumentPage(this, dynamicDocumentPaginator, page));
            }
            return(DocumentPage.Missing);
        }
Example #9
0
        /// <summary>
        /// Returns a FixedDocumentSequenceDocumentPage for the specified document and page number.
        /// </summary>
        internal DocumentPage GetPage(FixedDocument document, int fixedDocPageNumber)
        {
            if (fixedDocPageNumber < 0)
            {
                throw new ArgumentOutOfRangeException("fixedDocPageNumber", SR.Get(SRID.IDPNegativePageNumber));
            }

            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            DocumentPage innerDP = document.GetPage(fixedDocPageNumber);

            Debug.Assert(innerDP != null);

            // Now wrap inner DP and return it
            return(new FixedDocumentSequenceDocumentPage(this, document.DocumentPaginator as DynamicDocumentPaginator, innerDP));
        }
Example #10
0
        // Token: 0x06003516 RID: 13590 RVA: 0x000F0AD0 File Offset: 0x000EECD0
        private FixedDocumentPage GetFixedPanelDocumentPage(Point pt)
        {
            DocumentGrid documentGrid = this._scope as DocumentGrid;

            if (documentGrid != null)
            {
                DocumentPage      documentPageFromPoint = documentGrid.GetDocumentPageFromPoint(pt);
                FixedDocumentPage fixedDocumentPage     = documentPageFromPoint as FixedDocumentPage;
                if (fixedDocumentPage == null)
                {
                    FixedDocumentSequenceDocumentPage fixedDocumentSequenceDocumentPage = documentPageFromPoint as FixedDocumentSequenceDocumentPage;
                    if (fixedDocumentSequenceDocumentPage != null)
                    {
                        fixedDocumentPage = (fixedDocumentSequenceDocumentPage.ChildDocumentPage as FixedDocumentPage);
                    }
                }
                return(fixedDocumentPage);
            }
            return(null);
        }
Example #11
0
        private FixedDocumentPage GetFixedPanelDocumentPage(Point pt)
        {
            DocumentGrid mpScope = _scope as DocumentGrid;

            if (mpScope != null)
            {
                DocumentPage      dp  = mpScope.GetDocumentPageFromPoint(pt);
                FixedDocumentPage fdp = dp as FixedDocumentPage;
                if (fdp == null)
                {
                    FixedDocumentSequenceDocumentPage fdsdp = dp as FixedDocumentSequenceDocumentPage;
                    if (fdsdp != null)
                    {
                        fdp = fdsdp.ChildDocumentPage as FixedDocumentPage;
                    }
                }
                return(fdp);
            }
            return(null);
        }
Example #12
0
        // Token: 0x06002B93 RID: 11155 RVA: 0x000C6EF0 File Offset: 0x000C50F0
        private void _OnGetPageCompleted(object sender, GetPageCompletedEventArgs args)
        {
            FixedDocumentSequence.GetPageAsyncRequest getPageAsyncRequest = (FixedDocumentSequence.GetPageAsyncRequest)args.UserState;
            this._pendingPages.Remove(getPageAsyncRequest.Page);
            DocumentPage page       = DocumentPage.Missing;
            int          pageNumber = getPageAsyncRequest.Page.PageNumber;

            if (!args.Cancelled && args.Error == null && args.DocumentPage != DocumentPage.Missing)
            {
                page = new FixedDocumentSequenceDocumentPage(this, (DynamicDocumentPaginator)sender, args.DocumentPage);
                this._SynthesizeGlobalPageNumber((DynamicDocumentPaginator)sender, args.PageNumber, out pageNumber);
            }
            if (!args.Cancelled)
            {
                ArrayList arrayList = new ArrayList();
                IEnumerator <KeyValuePair <object, FixedDocumentSequence.GetPageAsyncRequest> > enumerator = this._asyncOps.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <object, FixedDocumentSequence.GetPageAsyncRequest> keyValuePair = enumerator.Current;
                        FixedDocumentSequence.GetPageAsyncRequest value = keyValuePair.Value;
                        if (getPageAsyncRequest.Page.Equals(value.Page))
                        {
                            ArrayList arrayList2 = arrayList;
                            keyValuePair = enumerator.Current;
                            arrayList2.Add(keyValuePair.Key);
                            this._NotifyGetPageAsyncCompleted(page, pageNumber, args.Error, value.Cancelled, value.UserState);
                        }
                    }
                }
                finally
                {
                    foreach (object key in arrayList)
                    {
                        this._asyncOps.Remove(key);
                    }
                }
            }
        }
        // Token: 0x06002CE2 RID: 11490 RVA: 0x000CA868 File Offset: 0x000C8A68
        private void OnGetPageRootCompleted(object sender, GetPageRootCompletedEventArgs args)
        {
            PageContent pageContent = (PageContent)sender;

            pageContent.GetPageRootCompleted -= this.OnGetPageRootCompleted;
            this._pendingPages.Remove(pageContent);
            ArrayList arrayList = new ArrayList();
            IEnumerator <KeyValuePair <object, FixedDocument.GetPageAsyncRequest> > enumerator = this._asyncOps.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <object, FixedDocument.GetPageAsyncRequest> keyValuePair = enumerator.Current;
                    FixedDocument.GetPageAsyncRequest value = keyValuePair.Value;
                    if (value.PageContent == pageContent)
                    {
                        ArrayList arrayList2 = arrayList;
                        keyValuePair = enumerator.Current;
                        arrayList2.Add(keyValuePair.Key);
                        DocumentPage page = DocumentPage.Missing;
                        if (!value.Cancelled && !args.Cancelled && args.Error == null)
                        {
                            FixedPage result    = args.Result;
                            Size      fixedSize = this.ComputePageSize(result);
                            page = new FixedDocumentPage(this, result, fixedSize, this.Pages.IndexOf(pageContent));
                        }
                        this._NotifyGetPageAsyncCompleted(page, value.PageNumber, args.Error, value.Cancelled, value.UserState);
                    }
                }
            }
            finally
            {
                foreach (object key in arrayList)
                {
                    this._asyncOps.Remove(key);
                }
            }
        }
 // Token: 0x06002CD9 RID: 11481 RVA: 0x000CA170 File Offset: 0x000C8370
 private void OnInitialized(object sender, EventArgs e)
 {
     if (this._navigateAfterPagination)
     {
         FixedHyperLink.NavigateToElement(this, this._navigateFragment);
         this._navigateAfterPagination = false;
     }
     this.ValidateDocStructure();
     if (this.PageCount > 0)
     {
         DocumentPage page = this.GetPage(0);
         if (page != null)
         {
             FixedPage fixedPage = page.Visual as FixedPage;
             if (fixedPage != null)
             {
                 base.Language = fixedPage.Language;
             }
         }
     }
     this._paginator.NotifyPaginationCompleted(e);
 }
Example #15
0
 /// <summary>
 /// Adds a new DocumentPage to the Watcher
 /// </summary>
 /// <param name="page">The page to add</param>
 public void AddPage(DocumentPage page)
 {
     if (!_table.Contains(page))
     {
         _table.Add(page, false);
         page.PageDestroyed += new EventHandler(OnPageDestroyed);
     }
     else
     {
         _table[page] = false;
     }            
 }
Example #16
0
 /// <summary>
 /// Indicates whether the specified DocumentPage has been destroyed.
 /// </summary>
 /// <param name="page"></param>
 /// <returns></returns>
 public bool IsDestroyed(DocumentPage page)
 {
     if (_table.Contains(page))
     {
         return (bool)_table[page];
     }
     else
     {                
         return true;
     }
 }
 /// <summary>
 /// Returns the ContentPosition for the given page.
 /// </summary>
 /// <param name="page">Document page.</param>
 /// <returns>Returns the ContentPosition for the given page.</returns>
 /// <exception cref="ArgumentException">
 /// Throws ArgumentException if the page is not valid.
 /// </exception>
 public abstract ContentPosition GetPagePosition(DocumentPage page);
Example #18
0
 protected override void InsertPageMarkers(int pageNumber, DocumentPage documentPage)
 {
 }
        /// <summary> 
        /// Returns the ContentPosition for the given page.
        /// </summary> 
        /// <param name="page">Document page.</param>
        /// <returns>Returns the ContentPosition for the given page.</returns>
        /// <exception cref="ArgumentException">
        /// Throws ArgumentException if the page is not valid. 
        /// </exception>
        public override ContentPosition GetPagePosition(DocumentPage page) 
        { 
            FlowDocumentPage flowDocumentPage;
            ITextView textView; 
            ITextPointer position;
            Point point, newPoint;
            MatrixTransform transform;
 
            // Ensure usage from just one Dispatcher object.
            // FlowDocumentPaginator runs its own layout, hence there is a need 
            // to protect it from random access from other threads. 
            _dispatcherObject.VerifyAccess();
 
            // ContentPosition cannot be null.
            if (page == null)
            {
                throw new ArgumentNullException("page"); 
            }
            // DocumentPage must be of appropriate type. 
            flowDocumentPage = page as FlowDocumentPage; 
            if (flowDocumentPage == null || flowDocumentPage.IsDisposed)
            { 
                return ContentPosition.Missing;
            }

            // DocumentPage.Visual for printing scenarions needs to be always returned 
            // in LeftToRight FlowDirection. Hence, if the document is RightToLeft,
            // mirroring transform need to be applied to the content of DocumentPage.Visual. 
            point = new Point(0, 0); 
            if (_document.FlowDirection == FlowDirection.RightToLeft)
            { 
                transform = new MatrixTransform(-1.0, 0.0, 0.0, 1.0, flowDocumentPage.Size.Width, 0.0);
                transform.TryTransform(point, out newPoint);
                point = newPoint;
            } 

            // Get TextView for DocumentPage. Position of the page is calculated through hittesting 
            // the top-left of the page. If position cannot be found, the start position of 
            // the first range for TextView is treated as ContentPosition for the page.
            textView = (ITextView)((IServiceProvider)flowDocumentPage).GetService(typeof(ITextView)); 
            Invariant.Assert(textView != null, "Cannot access ITextView for FlowDocumentPage.");
            Invariant.Assert(textView.TextSegments.Count > 0, "Page cannot be empty.");
            position = textView.GetTextPositionFromPoint(point, true);
            if (position == null) 
            {
                position = textView.TextSegments[0].Start; 
            } 
            return (position is TextPointer) ? (ContentPosition)position : ContentPosition.Missing;
        } 
 public GetPageCompletedEventArgs(DocumentPage page, int pageNumber, Exception error, bool cancelled, Object userState) : base (default(Exception), default(bool), default(Object))
 {
 }
        /// <summary>
        /// Gets first and last TP on a documentPage. 
        /// </summary>
        /// <param name="documentPage">the document page</param>
        /// <param name="start">start TP</param>
        /// <param name="end">end TP</param>
        /// <returns>true if there aretext segments on this page, otherwise false</returns>
        private static bool GetTextViewRange(DocumentPage documentPage, out ITextPointer start, out ITextPointer end)
        {
            ITextView textView;
            start = end = null;

            // Missing pages can't produce TextPointers
            Invariant.Assert(documentPage != DocumentPage.Missing);

            textView = ((IServiceProvider)documentPage).GetService(typeof(ITextView)) as ITextView;
            Invariant.Assert(textView != null, "DocumentPage didn't provide a TextView.");

            //check if there is any content
            if ((textView.TextSegments == null) || (textView.TextSegments.Count == 0))
                return false;

            start = textView.TextSegments[0].Start.CreatePointer(LogicalDirection.Forward);
            end = textView.TextSegments[textView.TextSegments.Count - 1].End.CreatePointer(LogicalDirection.Backward);
            Debug.Assert((start != null) && (end != null), "null start/end TextPointer on a non empty page");
            return true;
        }
 /// <summary>
 /// <see cref="DynamicDocumentPaginator.GetPagePosition"/>
 /// </summary>
 internal ContentPosition GetPagePosition(DocumentPage page)
 {
     FixedDocumentSequenceDocumentPage docPage = page as FixedDocumentSequenceDocumentPage;
     if (docPage == null)
     {
         return ContentPosition.Missing;
     }
     return docPage.ContentPosition;
 }
 // Token: 0x06002CE3 RID: 11491 RVA: 0x000CA9B8 File Offset: 0x000C8BB8
 private void _NotifyGetPageAsyncCompleted(DocumentPage page, int pageNumber, Exception error, bool cancelled, object userState)
 {
     this._paginator.NotifyGetPageCompleted(new GetPageCompletedEventArgs(page, pageNumber, error, cancelled, userState));
 }
Example #24
0
        private static SlideModel CreateSlide(DocumentPage page, DeckModel deck)
        {
            int slideWidth = (int)page.Size.Width;
            int slideHeight = (int)page.Size.Height;

            //Create a new SlideModel
            SlideModel newSlideModel = new SlideModel(Guid.NewGuid(), new LocalId(), SlideDisposition.Empty, new Rectangle(0, 0, slideWidth, slideHeight));

            //Create a XPSPageSheetModel for each XPS Page
            XPSPageSheetModel sheet = new XPSPageSheetModel(page, new XPSDocumentPageWrapper(page), Guid.NewGuid(), SheetDisposition.All, new Rectangle(0, 0, slideWidth, slideHeight), slideHeight);

            //Add XPSPageSheetModel into SlideModel
            using (Synchronizer.Lock(newSlideModel.SyncRoot))
            {
                newSlideModel.ContentSheets.Add(sheet);
            }

            deck.InsertSlide(newSlideModel);

            return newSlideModel;
        }
        // Formats entire document into pages.
        void Format()
        {
            // Store each line of the document as with LineWithFlag object.
            List<PrintLine> listLines = new List<PrintLine>();

            // Use this for some basic calculations.
            FormattedText formtxtSample = GetFormattedText("W");

            // Width of printed line.
            double width = PageSize.Width - Margins.Left - Margins.Right;

            // Serious problem: Abandon ship.
            if (width < formtxtSample.Width)
                return;

            string strLine;
            Pen pn = new Pen(Brushes.Black, 2);
            StringReader reader = new StringReader(txt);

            // Call ProcessLine to store each line in listLines.
            while (null != (strLine = reader.ReadLine()))
                ProcessLine(strLine, width, listLines);

            reader.Close();

            // Now start getting ready to print pages.
            double heightLine = formtxtSample.LineHeight + formtxtSample.Height;
            double height = PageSize.Height - Margins.Top - Margins.Bottom;
            int linesPerPage = (int)(height / heightLine);

            // Serious problem: Abandon ship.
            if (linesPerPage < 1)
                return;

            int numPages = (listLines.Count + linesPerPage - 1) / linesPerPage;
            double xStart = Margins.Left;
            double yStart = Margins.Top;

            // Create the List to store each DocumentPage object.
            listPages = new List<DocumentPage>();

            for (int iPage = 0, iLine = 0; iPage < numPages; iPage++)
            {
                // Create the DrawingVisual and open the DrawingContext.
                DrawingVisual vis = new DrawingVisual();
                DrawingContext dc = vis.RenderOpen();

                // Display header at top of page.
                if (Header != null && Header.Length > 0)
                {
                    FormattedText formtxt = GetFormattedText(Header);
                    formtxt.SetFontWeight(FontWeights.Bold);
                    Point ptText = new Point(xStart, yStart - 2 * formtxt.Height);
                    dc.DrawText(formtxt, ptText);
                }

                // Display footer at bottom of page.
                if (numPages > 1)
                {
                    FormattedText formtxt =
                        GetFormattedText("Page " + (iPage+1) + " of " + numPages);
                    formtxt.SetFontWeight(FontWeights.Bold);
                    Point ptText = new Point(
                        (PageSize.Width + Margins.Left -
                                            Margins.Right - formtxt.Width) / 2,
                        PageSize.Height - Margins.Bottom + formtxt.Height);
                    dc.DrawText(formtxt, ptText);
                }

                // Look through the lines on the page.
                for (int i = 0; i < linesPerPage; i++, iLine++)
                {
                    if (iLine == listLines.Count)
                        break;

                    // Set up information to display the text of the line.
                    string str = listLines[iLine].String;
                    FormattedText formtxt = GetFormattedText(str);
                    Point ptText = new Point(xStart, yStart + i * heightLine);
                    dc.DrawText(formtxt, ptText);

                    // Possibly display the little arrow flag.
                    if (listLines[iLine].Flag)
                    {
                        double x = xStart + width + 6;
                        double y = yStart + i * heightLine + formtxt.Baseline;
                        double len = face.CapsHeight * em;
                        dc.DrawLine(pn, new Point(x, y),
                                        new Point(x + len, y - len));
                        dc.DrawLine(pn, new Point(x, y),
                                        new Point(x, y - len / 2));
                        dc.DrawLine(pn, new Point(x, y),
                                        new Point(x + len / 2, y));
                    }
                }
                dc.Close();

                // Create DocumentPage object based on visual.
                DocumentPage page = new DocumentPage(vis);
                listPages.Add(page);
            }
            reader.Close();
        }
Example #26
0
 /// <summary>
 /// Removes an existing page from the Watcher
 /// </summary>
 /// <param name="page"></param>
 public void RemovePage(DocumentPage page)
 {
     if (_table.Contains(page))
     {
         _table.Remove(page);
         page.PageDestroyed -= new EventHandler(OnPageDestroyed);
     }            
 }
Example #27
0
    static public BitmapSource BitmapSourceFromPage(DocumentPage docPage, double resolution)
    {
      double pixelWidth = docPage.Size.Width * resolution / 96;
      double pixelHeight = docPage.Size.Height * resolution / 96;
      RenderTargetBitmap renderTarget = new RenderTargetBitmap((int)pixelWidth, (int)pixelHeight, resolution, resolution, PixelFormats.Default);
      renderTarget.Render(docPage.Visual);

      return renderTarget;

      //PngBitmapEncoder encoder = new PngBitmapEncoder();  // Choose type here ie: JpegBitmapEncoder, etc   
      //encoder.Frames.Add(BitmapFrame.Create(renderTarget));

      //BitmapSource.Create(pageWidth, pageHeight, resolution, resolution, PixelFormats.)

      //return encoder.Preview;
      //encoder.
      //BitmapSource s = Xps;
      ////FileStream pageOutStream = new FileStream(xpsFileName + ".Page" + pageNum + ".bmp", FileMode.Create, FileAccess.Write);
      //MemoryStream memStream = new MemoryStream();
      //encoder.Save(memStream);
      //return memStream.ToArray();
    }
        /// <summary>
        /// Gets the last visible TP on a DocumentPage
        /// </summary>
        /// <param name="documentPage">document page</param>
        /// <returns>The last visible TP or null if no visible TP on the page</returns>
        private static ITextPointer FindEndVisibleTextPointer(DocumentPage documentPage)
        {
            ITextPointer start, end;
            if (!GetTextViewRange(documentPage, out start, out end))
                return null;

            if (!end.IsAtInsertionPosition && !end.MoveToNextInsertionPosition(LogicalDirection.Backward))
            {
                //there is no insertion point in this direction
                return null;
            }
            //check if it is outside of the page
            if (start.CompareTo(end) > 0)
                return null;

            return end;

        }
        protected virtual void InsertPageMarkers(int pageNumber, DocumentPage documentPage)
        {
            var labelDrawingVisual = new DrawingVisual();
            using (var drawingContext = labelDrawingVisual.RenderOpen())
            {
                var pageNumberContent = pageNumber + "/" + PageCount;
                var ft = new FormattedText(pageNumberContent,
                                           Thread.CurrentThread.CurrentCulture,
                                           FlowDirection.LeftToRight,
                                           new Typeface("Verdana"),
                                           15, Brushes.Black);

                drawingContext.DrawText(ft, new Point(PageMargins.Left, PageMargins.Top));
            }

            var drawingGroup = new DrawingGroup();
            drawingGroup.Children.Add(((DrawingVisual)documentPage.Visual).Drawing);
            drawingGroup.Children.Add(labelDrawingVisual.Drawing);

            var currentDrawingVisual = (DrawingVisual)documentPage.Visual;
            using (var currentDrawingContext = currentDrawingVisual.RenderOpen())
            {
                currentDrawingContext.DrawDrawing(drawingGroup);
                currentDrawingContext.PushOpacityMask(Brushes.White);
            }
        }
        // ��ü ������ �������� ������.
        void Format()
        {
            // LinewWithFlag ��ü�� ������ �� ���� ����
            List<PrintLine> listLines = new List<PrintLine>();

            // �� ���� �⺻���� ��꿡 �̸� �̿�
            FormattedText formtxtSample = GetFormattedText("W");

            // �μ�Ǵ� ���� ��
            double width = PageSize.Width - Margins.Left - Margins.Right;

            // �ɰ��� ���� : �۾����� -> �μ⹮���� ����������� Ŭ��
            if (width < formtxtSample.Width)
                return;

            string strLine;
            Pen pn = new Pen(Brushes.Black, 2);
            StringReader reader = new StringReader(txt);

            // listLines�� �� ���� �����ϱ� ���� ProcessLine�� ȣ��.
            while (null != (strLine = reader.ReadLine()))
                ProcessLine(strLine, width, listLines);

            reader.Close();

            // �������� �μ��� �غ� ����.
            double heightLine = formtxtSample.LineHeight + formtxtSample.Height;
            double height = PageSize.Height - Margins.Top - Margins.Bottom;
            int linesPerPage = (int)(height / heightLine);

            // Serious problem: Abandon ship.   // ��� ������ ������ ������
            if (linesPerPage < 1)
                return;

            int numPages = (listLines.Count + linesPerPage - 1) / linesPerPage;// ��� ������ ��
            double xStart = Margins.Left;
            double yStart = Margins.Top;

            // DocumentPage.
            listPages = new List<DocumentPage>();

            for (int iPage = 0, iLine = 0; iPage < numPages; iPage++)
            {
                // DrawingVisual ��ü�� ������ Drawing Context�� ����.
                // DrawingVisual class
                // DrawingVisual�� ȭ�鿡�� ���� �׷����� �������ϴ� ��
                //  ����� �� �ִ� �ð��� ��ü�Դϴ�. ������ �ý��ۿ��� �����˴ϴ�.

                DrawingVisual vis = new DrawingVisual();

                //DrawingContext class
                //�׸���, Ǫ�� �� �� ����� ����Ͽ� ǥ�� ������ �����մϴ�
                DrawingContext dc = vis.RenderOpen();

                // ������ ��ܿ� ����� ���.
                if (Header != null && Header.Length > 0)
                {
                    FormattedText formtxt = GetFormattedText(Header);
                    formtxt.SetFontWeight(FontWeights.Bold);
                    Point ptText = new Point(xStart, yStart - 2 * formtxt.Height);
                    dc.DrawText(formtxt, ptText);
                }

                // ������ �ϴܿ� ������ ���.
                if (numPages > 1)
                {
                    FormattedText formtxt =
                        GetFormattedText("Page " + (iPage+1) + " of " + numPages);
                    formtxt.SetFontWeight(FontWeights.Bold);
                    Point ptText = new Point(
                        (PageSize.Width + Margins.Left -
                                            Margins.Right - formtxt.Width) / 2,
                        PageSize.Height - Margins.Bottom + formtxt.Height);
                    dc.DrawText(formtxt, ptText);
                }

                // ���������� �� �ٿ� ���� ó��.
                for (int i = 0; i < linesPerPage; i++, iLine++)
                {
                    if (iLine == listLines.Count)
                        break;

                    // ���� �ؽ�Ʈ�� �����ֱ� ���� ������ ����.
                    string str = listLines[iLine].String;
                    FormattedText formtxt = GetFormattedText(str);
                    Point ptText = new Point(xStart, yStart + i * heightLine);
                    dc.DrawText(formtxt, ptText);

                    // ���� ȭ��ǥ �÷��� ���.
                    if (listLines[iLine].Flag)
                    {
                        double x = xStart + width + 6;
                        double y = yStart + i * heightLine + formtxt.Baseline;
                        double len = face.CapsHeight * em;
                        dc.DrawLine(pn, new Point(x, y),
                                        new Point(x + len, y - len));
                        dc.DrawLine(pn, new Point(x, y),
                                        new Point(x, y - len / 2));
                        dc.DrawLine(pn, new Point(x, y),
                                        new Point(x + len / 2, y));
                    }
                }
                dc.Close();

                // Visual ����� Document Page ��ü�� ����.
                //������ �����ڿ� ���� ������ ���� �������� ��Ÿ���ϴ�.
                DocumentPage page = new DocumentPage(vis);
                listPages.Add(page);
            }
            reader.Close();
        }
Example #31
0
        public override DocumentPage GetPage(int pageNumber)
        {
            var page = base.GetPage(pageNumber);
            var headerVisual = new DrawingVisual();
            using (var drawingContext = headerVisual.RenderOpen())
            {
                var rowNumber = pageNumber % HorizontalPageCount;
                var contentWidth = GetPageWidth(rowNumber);

                CreateHeader(rowNumber,drawingContext,pageNumber+1);
                if (PrintTableDefination.HasFooter)
                {
                    var text3 = new FormattedText(PrintTableDefination.FooterText, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);
                    drawingContext.DrawText(text3, new Point(PageMargins.Left, PageSize.Height - PageMargins.Bottom - text3.Height));
                }

                var contentTop = PageMargins.Top + HeaderHeight;
                var gridLineBrush = Brushes.Gray;
                const double gridLineThickness = 0.5;
                var gridLinePen = new Pen(gridLineBrush, gridLineThickness);

                if (PrintTableDefination.ColumnNames != null)
                {
                    drawingContext.DrawRectangle(Brushes.Transparent, gridLinePen, new Rect(PageMargins.Left - 1, contentTop - PrintTableDefination.ColumnHeaderHeight, contentWidth, PrintTableDefination.ColumnHeaderHeight));
                    drawingContext.DrawRectangle(gridLineBrush, gridLinePen, new Rect(PageMargins.Left - 1, contentTop - 2, contentWidth, 2));

                    var cumilativeColumnNumber = 0;
                    var columnLeft = PageMargins.Left - 1;
                    var currentPageColumns = rowNumber == HorizontalPageCount - 1 ? ColumnCount[rowNumber] - 1 : ColumnCount[rowNumber];
                    for (int j = 0; j < rowNumber; j++)
                    {
                        cumilativeColumnNumber += ColumnCount[j];
                    }
                    for (int i = cumilativeColumnNumber; i < cumilativeColumnNumber + currentPageColumns; i++)
                    {
                        var columnWidth = PrintTableDefination.ColumnWidths[i];
                        var colName = PrintTableDefination.ColumnNames[i];
                        if (colName == string.Empty)
                        {
                            drawingContext.DrawRectangle(gridLineBrush, gridLinePen, new Rect(columnLeft, contentTop - PrintTableDefination.ColumnHeaderHeight, columnWidth, PrintTableDefination.ColumnHeaderHeight));
                        }
                        else
                        {
                            var columnName = new FormattedText(colName, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), PrintTableDefination.ColumnHeaderFontSize, PrintTableDefination.ColumnHeaderBrush)
                                                 {
                                                     MaxTextWidth = columnWidth,
                                                     MaxLineCount = 1,
                                                     Trimming = TextTrimming.CharacterEllipsis
                                                 };
                            drawingContext.DrawText(columnName, new Point(columnLeft + 5, contentTop - PrintTableDefination.ColumnHeaderHeight));
                        }
                        columnLeft += columnWidth;
                        drawingContext.DrawRectangle(gridLineBrush, gridLinePen, new Rect(columnLeft, contentTop - PrintTableDefination.ColumnHeaderHeight, gridLineThickness, PrintTableDefination.ColumnHeaderHeight));

                    }
                    if (rowNumber == HorizontalPageCount - 1)
                    {
                        var columnWidth =
                            PrintTableDefination.ColumnWidths[cumilativeColumnNumber + ColumnCount[rowNumber] - 1];
                        var colName =
                            PrintTableDefination.ColumnNames[cumilativeColumnNumber + ColumnCount[rowNumber] - 1];
                        if (colName == string.Empty)
                        {
                            drawingContext.DrawRectangle(gridLineBrush, gridLinePen, new Rect(columnLeft, contentTop - PrintTableDefination.ColumnHeaderHeight - 2, columnWidth, PrintTableDefination.ColumnHeaderHeight));
                        }
                        else
                        {
                            var columnName = new FormattedText(colName, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), PrintTableDefination.ColumnHeaderFontSize, Brushes.Black)
                                                 {
                                                     MaxTextWidth = columnWidth,
                                                     MaxLineCount = 1,
                                                     Trimming = TextTrimming.CharacterEllipsis
                                                 };
                            drawingContext.DrawText(columnName, new Point(columnLeft + 5, contentTop - PrintTableDefination.ColumnHeaderHeight));
                        }
                    }
                }
                if (ShowPageMarkers)
                {
                    var pageNumberText = new FormattedText(string.Format("{0}", pageNumber + 1), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, gridLineBrush);
                    drawingContext.DrawText(pageNumberText, new Point(PageMargins.Left + 5, PrintablePageHeight - pageNumberText.Height + 15));
                }
                drawingContext.PushOpacityMask(Brushes.White);
            }

            var drawingGroup = new DrawingGroup();
            drawingGroup.Children.Add(((DrawingVisual)page.Visual).Drawing);
            drawingGroup.Children.Add(headerVisual.Drawing);

            var currentDrawingVisual = (DrawingVisual)page.Visual;
            currentDrawingVisual.Transform = new TranslateTransform(PageMargins.Left, PageMargins.Top);

            var currentDrawingContext = currentDrawingVisual.RenderOpen();
            currentDrawingContext.DrawDrawing(drawingGroup);
            currentDrawingContext.PushOpacityMask(Brushes.White);
            currentDrawingContext.Close();
            var documentPage = new DocumentPage(currentDrawingVisual, PageSize, FrameRect, FrameRect);
            OnGetPageCompleted(new GetPageCompletedEventArgs(documentPage, pageNumber, null, false, null));
            return documentPage;
        }
        public override DocumentPage GetPage(int pageNumber)
        {
            //var ctl = new ContentControl();
            //ctl.Content = this.DrawingVisual;
            //ctl.RenderTransform = new TranslateTransform(-PageSize.Width * (pageNumber % GetHorizontalPageCount()), -PageSize.Height * (pageNumber / GetVerticalPageCount()));
            //ctl.Measure(PageSize);
            //ctl.Arrange(new Rect(new Point(0, 0), PageSize));

            //var page = new DocumentPage(ctl);
            //ctl.RenderTransform = null;

            //return page;

            DrawingVisual pageVisual = GetPageVisual(pageNumber);
            var documentPage = new DocumentPage(pageVisual, PageSize, FrameRect, FrameRect);
            if (ShowPageMarkers)
                InsertPageMarkers(pageNumber + 1, documentPage);
            OnPageCreated(new PageEventArgs(pageNumber));
            return documentPage;
        }
        // ------------------------------------------------------------------
        // Dump content of DocumentPage.
        // ------------------------------------------------------------------
        internal static void DumpDocumentPage(XmlTextWriter writer, DocumentPage page, Visual parent)
        {
            writer.WriteStartElement("DocumentPage");
            writer.WriteAttributeString("Type", page.GetType().FullName);

            if (page != DocumentPage.Missing)
            {
                DumpSize(writer, "Size", page.Size);

                // Dump transform relative to its parent
                GeneralTransform g = page.Visual.TransformToAncestor(parent);
                Point point = new Point(0, 0);
                g.TryTransform(point, out point);
                if (point.X != 0 || point.Y != 0)
                {
                    DumpPoint(writer, "Position", point);
                }

                // Dump page specific information
                Type t = page.GetType();
                DumpCustomDocumentPage dumpDocumentPage = null;
                while(dumpDocumentPage==null && t!=null)
                {                
                    dumpDocumentPage = _documentPageToDumpHandler[t] as DumpCustomDocumentPage;
                    t = t.BaseType;
                }
                if (dumpDocumentPage != null)
                {
                    dumpDocumentPage(writer, page);
                }                
            }

            writer.WriteEndElement();
        }
        /// <summary>
        /// This is most important method, modifies the original 
        /// </summary>
        /// <param name="pageNumber">page number</param>
        /// <returns></returns>
        public override DocumentPage GetPage(int pageNumber)
        {
            for (int i = 0; i < 2; i++) // do it twice because filling context values could change the page count
            {
                // compute page count
                if (pageNumber == 0)
                {
                    _paginator.ComputePageCount();
                    _pageCount = _paginator.PageCount;
                }

                // fill context values
                FillContextValues(_reportContextValues, pageNumber + 1);
            }

            DocumentPage page = _paginator.GetPage(pageNumber);
            if (page == DocumentPage.Missing) return DocumentPage.Missing; // page missing

            _pageSize = page.Size;

            // add header block
            ContainerVisual newPage = new ContainerVisual();

            if (_blockPageHeader != null)
            {
                ContainerVisual v = CloneVisualBlock(_blockPageHeader, pageNumber + 1);
                v.Offset = new Vector(0, 0);
                newPage.Children.Add(v);
            }

            // TODO: process ReportContextValues

            // add content page
            ContainerVisual smallerPage = new ContainerVisual();
            smallerPage.Offset = new Vector(0, _report.PageHeaderHeight / 100d * _report.PageHeight);
            smallerPage.Children.Add(page.Visual);
            newPage.Children.Add(smallerPage);

            // add footer block
            if (_blockPageFooter != null)
            {
                ContainerVisual v = CloneVisualBlock(_blockPageFooter, pageNumber + 1);
                v.Offset = new Vector(0, _report.PageHeight - _report.PageFooterHeight / 100d * _report.PageHeight);
                newPage.Children.Add(v);
            }

            // create modified BleedBox
            Rect bleedBox = new Rect(page.BleedBox.Left, page.BleedBox.Top, page.BleedBox.Width,
                _report.PageHeight - (page.Size.Height - page.BleedBox.Size.Height));

            // create modified ContentBox
            Rect contentBox = new Rect(page.ContentBox.Left, page.ContentBox.Top, page.ContentBox.Width,
                _report.PageHeight - (page.Size.Height - page.ContentBox.Size.Height));

            DocumentPage dp = new DocumentPage(newPage, new Size(_report.PageWidth, _report.PageHeight), bleedBox, contentBox);
            _report.FireEventGetPageCompleted(new GetPageCompletedEventArgs(page, pageNumber, null, false, null));
            return dp;
        }
Example #35
0
 public XPSDocumentPageWrapper(DocumentPage documentPage)
 {
     if (documentPage != null)
     {
         //Serialize the DocumentPage
         XpsSerializerFactory factory = new XpsSerializerFactory();
         MemoryStream ms = new MemoryStream();
         SerializerWriter writer=  factory.CreateSerializerWriter(ms);
         writer.Write(documentPage.Visual);
         m_XPSDocumentPageObject = ms.ToArray();
     }
 }
        //--------------------------------------------------------------------
        //
        // Ctors
        //
        //---------------------------------------------------------------------

        #region Ctors
        internal FixedDocumentSequenceDocumentPage(FixedDocumentSequence documentSequence, DynamicDocumentPaginator documentPaginator, DocumentPage documentPage)
            : base((documentPage is FixedDocumentPage) ? ((FixedDocumentPage)documentPage).FixedPage : documentPage.Visual, documentPage.Size, documentPage.BleedBox, documentPage.ContentBox)
        {
            Debug.Assert(documentSequence != null);
            Debug.Assert(documentPaginator != null);
            Debug.Assert(documentPage != null);
            _fixedDocumentSequence = documentSequence;
            _documentPaginator = documentPaginator;
            _documentPage = documentPage;
        }
Example #37
0
 // Notify the caller of IDFAsync.MeasurePageAsync
 private void _NotifyGetPageAsyncCompleted(DocumentPage page, int pageNumber, Exception error, bool cancelled, object userState)
 {
     DocumentsTrace.FixedDocumentSequence.IDF.Trace(string.Format("_NotifyGetPageAsyncCompleted"));
     _paginator.NotifyGetPageCompleted(new GetPageCompletedEventArgs(page, pageNumber, error, cancelled, userState));
 }
 // Notify the caller of IDFAsync.MeasurePageAsync
 private void _NotifyGetPageAsyncCompleted(DocumentPage page, int pageNumber, Exception error, bool cancelled, object userState)
 {
     DocumentsTrace.FixedDocumentSequence.IDF.Trace(string.Format("_NotifyGetPageAsyncCompleted"));
     _paginator.NotifyGetPageCompleted(new GetPageCompletedEventArgs(page, pageNumber, error, cancelled, userState));
 }
Example #39
0
		public override DocumentPage GetPage(int pageNumber)
		{
			pageNumber = pageNumber + _pageRange.PageFrom - 1;

			if (_prevPage != null)
				_prevPage.Dispose();

			double w = _doc.Pages[pageNumber].Width;
			double h = _doc.Pages[pageNumber].Height;
			if (PageRotation(_doc.Pages[pageNumber]) == PageRotate.Rotate270
				|| PageRotation(_doc.Pages[pageNumber]) == PageRotate.Rotate90)
			{
				var t = w; w = h; h = t;
				PrinterTicket.PageOrientation = PageOrientation.ReverseLandscape;
			}

			var visual = new DrawingVisual();
			var page = new DocumentPage(visual);
			page.PageDestroyed += Page_PageDestroyed;
			RenderPage(pageNumber, visual);
			_prevPage = page;


			if (PagePrinted != null)
			{
				var args = new PagePrintedEventArgs(pageNumber - _pageRange.PageFrom + 1, _pageCount);
				PagePrinted(this, args);
				if (args.Cancel)
					_pageCount = 0;
			}

			return page;
		}
 public override DocumentPage GetPage(int pageNumber)
 {
     DrawingVisual pageVisual = GetPageVisual(pageNumber);
     var documentPage = new DocumentPage(pageVisual, PageSize, FrameRect, FrameRect);
     if (ShowPageMarkers)
         InsertPageMarkers(pageNumber + 1, documentPage);
     OnPageCreated(new PageEventArgs(pageNumber));
     return documentPage;
 }
        ///<summary> 
        /// For a given page # and a page, returns a page that include the original
        /// page along with any annotations that are displayed on that page.
        /// </summary>
        /// <param name="page"></param> 
        /// <param name="pageNumber"></param>
        private DocumentPage ComposePageWithAnnotationVisuals(int pageNumber, DocumentPage page) 
        { 
            // Need to store these because our current highlight mechanism
            // causes the page to be disposed 
            Size tempSize = page.Size;

            AdornerDecorator decorator = new AdornerDecorator();
            decorator.FlowDirection = _flowDirection; 
            DocumentPageView dpv = new DocumentPageView();
            dpv.UseAsynchronousGetPage = false; 
            dpv.DocumentPaginator = _originalPaginator; 
            dpv.PageNumber = pageNumber;
            decorator.Child = dpv; 

            // Arrange the first time to get the DPV setup right
            decorator.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            decorator.Arrange(new Rect(decorator.DesiredSize)); 
            decorator.UpdateLayout();
 
            // Create a new one for each page because it keeps a cache of annotation components 
            // and we don't want to be holding them in memory once the page is no longer used
            AnnotationComponentManager manager = new MS.Internal.Annotations.Component.AnnotationComponentManager(null); 

            // Setup DPs and processors for annotation handling.  If the service isn't already
            // enabled the processors will be registered by the service when it is enabled.
            if (_isFixedContent) 
            {
                // Setup service to look for FixedPages in the content 
                AnnotationService.SetSubTreeProcessorId(decorator, FixedPageProcessor.Id); 
                // If the service is already registered, set it up for fixed content
                _locatorManager.RegisterSelectionProcessor(new FixedTextSelectionProcessor(), typeof(TextRange)); 
            }
            else
            {
                // Setup up an initial DataId used to identify the document 
                AnnotationService.SetDataId(decorator, "FlowDocument");
                _locatorManager.RegisterSelectionProcessor(new TextViewSelectionProcessor(), typeof(DocumentPageView)); 
                // Setup the selection processor, pre-targeting it at a specific DocumentPageView 
                TextSelectionProcessor textSelectionProcessor = new TextSelectionProcessor();
                textSelectionProcessor.SetTargetDocumentPageView(dpv); 
                _locatorManager.RegisterSelectionProcessor(textSelectionProcessor, typeof(TextRange));
            }

            // Get attached annotations for the page 
            IList<IAttachedAnnotation> attachedAnnotations = ProcessAnnotations(dpv);
 
            // Now make sure they have a visual component added to the DPV via the component manager 
            foreach (IAttachedAnnotation attachedAnnotation in attachedAnnotations)
            { 
                if (attachedAnnotation.AttachmentLevel != AttachmentLevel.Unresolved && attachedAnnotation.AttachmentLevel != AttachmentLevel.Incomplete)
                {
                    manager.AddAttachedAnnotation(attachedAnnotation, false);
                } 
            }
 
            // Update layout a second time to get the annotations layed out correctly 
            decorator.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            decorator.Arrange(new Rect(decorator.DesiredSize)); 
            decorator.UpdateLayout();

/*          Look into using the VisualBrush in order to get a dead page instead of a live one...
            VisualBrush visualBrush = new VisualBrush(decorator); 
            Rectangle rectangle = new Rectangle();
            rectangle.Fill = visualBrush; 
            rectangle.Margin = new Thickness(0); 
*/
 
            return new AnnotatedDocumentPage(page, decorator, tempSize, new Rect(tempSize), new Rect(tempSize));
        }
Example #42
0
 /// <summary>
 /// <see cref="DynamicDocumentPaginator.GetPagePosition"/>
 /// </summary>
 public override ContentPosition GetPagePosition(DocumentPage page)
 {
     return _document.GetPagePosition(page);
 }
Example #43
0
 // Token: 0x06002B95 RID: 11157 RVA: 0x000C7070 File Offset: 0x000C5270
 internal FixedDocumentSequenceDocumentPage(FixedDocumentSequence documentSequence, DynamicDocumentPaginator documentPaginator, DocumentPage documentPage) : base((documentPage is FixedDocumentPage) ? ((FixedDocumentPage)documentPage).FixedPage : documentPage.Visual, documentPage.Size, documentPage.BleedBox, documentPage.ContentBox)
 {
     this._fixedDocumentSequence = documentSequence;
     this._documentPaginator     = documentPaginator;
     this._documentPage          = documentPage;
 }
 /// <summary>
 /// Creates an AnnotationDocumentPage for the wrapped page with the specified
 /// visual and sizes.
 /// </summary> 
 public AnnotatedDocumentPage(DocumentPage basePage, Visual visual, Size pageSize, Rect bleedBox, Rect contentBox)
     : base(visual, pageSize, bleedBox, contentBox) 
 { 
     _basePage = basePage as IContentHost;
 } 
 public abstract ContentPosition GetPagePosition(DocumentPage page);
        // ------------------------------------------------------------------
        // Dump FlowDocumentPage specific data.
        // ------------------------------------------------------------------
        private static void DumpFlowDocumentPage(XmlTextWriter writer, DocumentPage page)
        {
            FlowDocumentPage flowDocumentPage = page as FlowDocumentPage;
            Debug.Assert(flowDocumentPage != null, "Dump function has to match page type.");

            // Dump private info.
            writer.WriteStartElement("FormattedLines");
            writer.WriteAttributeString("Count", flowDocumentPage.FormattedLinesCount.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            // Dump columns collection
            TextDocumentView tv = (TextDocumentView)((IServiceProvider)flowDocumentPage).GetService(typeof(ITextView));
            if (tv.IsValid)
            {
                DumpColumnResults(writer, tv.Columns, page.Visual);
            }
        }
Example #47
0
 public GetPageCompletedEventArgs(DocumentPage page, int pageNumber, Exception error, bool cancelled, Object userState) : base(default(Exception), default(bool), default(Object))
 {
 }