コード例 #1
0
ファイル: Base.cs プロジェクト: bossaia/alexandrialibrary
    /// <summary>
    /// Draws the page title and footer.
    /// </summary>
    public void DrawTitle(PdfPage page, XGraphics gfx, string title)
    {
      XRect rect = new XRect(new XPoint(), gfx.PageSize);
      rect.Inflate(-10, -15);
      XFont font = new XFont("Verdana", 14, XFontStyle.Bold);
      gfx.DrawString(title, font, XBrushes.MidnightBlue, rect, XStringFormats.TopCenter);

      rect.Offset(0, 5);
      font = new XFont("Verdana", 8, XFontStyle.Italic);
      XStringFormat format = new XStringFormat();
      format.Alignment = XStringAlignment.Near;
      format.LineAlignment = XLineAlignment.Far;
      gfx.DrawString("Created with " + PdfSharp.ProductVersionInfo.Producer, font, XBrushes.DarkOrchid, rect, format);

      font = new XFont("Verdana", 8);
      format.Alignment = XStringAlignment.Center;
      gfx.DrawString(Program.s_document.PageCount.ToString(), font, XBrushes.DarkOrchid, rect, format);

      Program.s_document.Outlines.Add(title, page, true);
    }
コード例 #2
0
ファイル: XRect.cs プロジェクト: mapilab/PDFsharp
 /// <summary>
 /// Returns a rectangle that is offset from the specified rectangle by using specified horizontal and vertical amounts.
 /// </summary>
 public static XRect Offset(XRect rect, double offsetX, double offsetY)
 {
     rect.Offset(offsetX, offsetY);
     return(rect);
 }
コード例 #3
0
ファイル: XRect.cs プロジェクト: mapilab/PDFsharp
 /// <summary>
 /// Returns a rectangle that is offset from the specified rectangle by using the specified vector.
 /// </summary>
 public static XRect Offset(XRect rect, XVector offsetVector)
 {
     rect.Offset(offsetVector.X, offsetVector.Y);
     return(rect);
 }
コード例 #4
0
ファイル: XRect.cs プロジェクト: AnthonyNystrom/Pikling
 /// <summary>
 /// Returns a rectangle that is offset from the specified rectangle by using specified horizontal and vertical amounts. 
 /// </summary>
 public static XRect Offset(XRect rect, double offsetX, double offsetY)
 {
   rect.Offset(offsetX, offsetY);
   return rect;
 }
コード例 #5
0
ファイル: XRect.cs プロジェクト: AnthonyNystrom/Pikling
 /// <summary>
 /// Returns a rectangle that is offset from the specified rectangle by using the specified vector. 
 /// </summary>
 public static XRect Offset(XRect rect, XVector offsetVector)
 {
   rect.Offset(offsetVector.X, offsetVector.Y);
   return rect;
 }
コード例 #6
0
        private void CreatePage(PdfDocument doc, string firstWord, string secondWord, string color)
        {
            var page = doc.AddPage();
            page.Size = PdfSharp.PageSize.A4;
            XRect topHalf = new XRect(20, 20, page.Width - 40, (page.Height / 2) - 30);
            XRect bottomHalf = new XRect(topHalf.TopLeft, topHalf.BottomRight);
            bottomHalf.Offset(0, page.Height / 2 - 15);

            using (XGraphics gfx = XGraphics.FromPdfPage(page))
            {
                if (string.IsNullOrWhiteSpace(firstWord) == false)
                {
                    DrawCorners(topHalf, gfx);
                    DrawWord(firstWord, gfx, topHalf, color);
                }

                if (string.IsNullOrWhiteSpace(secondWord) == false)
                {
                    DrawCorners(bottomHalf, gfx);
                    DrawWord(secondWord, gfx, bottomHalf, color);
                }
            }
        }