コード例 #1
0
        /// <summary>
        /// Exports the page.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <param name="doc">The document.</param>
        /// <param name="page">The page.</param>
        void ExportPage(ExporterState state, PdfDocument doc, GcPageBlock page)
        {
            PdfPage page2 = doc.Pages.AddNewPage(this.context.GetDot((float)page.Width), this.context.GetDot((float)page.Height));

            if (this.settings.PageDuration >= 0)
            {
                page2.PageDuration = this.settings.PageDuration;
            }
            if (this.settings.PageTransition != PageTransitionType.Default)
            {
                page2.PageTransition.TransitionType = this.settings.PageTransition;
            }
            state.CurrentPage = page2;
            PdfContent content = page2.AddNewContent();

            content.Filters.Enqueue(PdfFilter.FlateFilter);
            PdfGraphics pdfGraphics = content.Graphics;
            Graphics    g           = new Graphics(this.context, this, pdfGraphics);

            if (state.BlackAndWhite)
            {
                g.GrayMode = true;
            }
            g.SaveState();
            g.Scale((double)this.context.GetForce(), (double)-this.context.GetForce());
            g.Translate(0.0, -page.Height);
            new GcPaintHelper().Paint(page, g, state);
            g.RestoreState();
        }
コード例 #2
0
        /// <summary>
        /// Exports the empty page.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <param name="doc">The document.</param>
        void ExportEmptyPage(ExporterState state, PdfDocument doc)
        {
            PdfPage page = doc.Pages.AddNewPage(this.context.GetDot((float)this.context.PageRects.PageRectangle.Width), this.context.GetDot((float)this.context.PageRects.PageRectangle.Height));

            state.CurrentPage = page;
            PdfContent content = page.AddNewContent();

            content.Filters.Enqueue(PdfFilter.FlateFilter);
            PdfGraphics pdfGraphics = content.Graphics;
            Graphics    g           = new Graphics(this.context, this, pdfGraphics);

            g.SaveState();
            g.Scale((double)this.context.GetForce(), (double)-this.context.GetForce());
            g.Translate(0.0, -this.context.PageRects.PageRectangle.Height);
            GcLabel label = new GcLabel((int)((this.context.PageRects.PageRectangle.Width / 2.0) - 220.0), (int)(this.context.PageRects.PageRectangle.Height / 3.0), 440, 100)
            {
                Text = "No Page can be print, please check the settings.",
                Font = new Font(this.context.DefaultFont.FontFamily.ToString(), 20.0)
            };

            label.Alignment.VerticalAlignment   = TextVerticalAlignment.Center;
            label.Alignment.HorizontalAlignment = TextHorizontalAlignment.Center;
            label.Alignment.WordWrap            = true;
            label.Foreground = FillEffects.Red;
            label.Background = new SolidColorBrush(Colors.Red);
            GcPaintHelper.PaintLabel(label.GetBlock(this.context), g, state);
            g.RestoreState();
        }