Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8444141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:19:45+00:00 2026-06-10T09:19:45+00:00

hi im using PDFSharp for creating PDF-Document for some diagrams. after converting my diagrams

  • 0

hi im using PDFSharp for creating PDF-Document for some diagrams. after converting my diagrams in PDF, i should print them on one Page for very small Diagrams, but if i have big-Diagrams then printing them on one Page produce a bad Printing quality the diagram will be small displayed and the diagram content is not readable. if i give a high Scale, the diagram will be larger displayed but some of the nodes will disapear.

so how can i create more pages that depend on my Scale and Diagram-Size?

private void convertBitmap(BitmapSource Img)
{
  try
  {
     PdfSharp.Pdf.PdfDocument document = new PdfSharp.Pdf.PdfDocument();
     document.Info.Title = activeDiagram.Model.Name;
     PdfSharp.Pdf.PdfPage pdfPage = document.AddPage();
     XGraphics gfx = XGraphics.FromPdfPage(pdfPage);
     XImage xIMage = XImage.FromBitmapSource(Img);
     XImage logo = XImage.FromFile("logo.png");
     pdfPage.Width = xIMage.PointWidth;
     pdfPage.Height = xIMage.PointHeight;
     //draw the logo
     gfx.DrawImage(xIMage, 15, 70, pdfPage.Width, pdfPage.Height);
     gfx.DrawImage(logo, 500, 5);
     // Draw the texts
     string typ = "";
     if (activeDiagram == myDiagram1)
         typ = "EPC";

     XFont font = new XFont("Arial", 12, XFontStyle.Bold);
     XFont font2 = new XFont("Arial", 10, XFontStyle.Bold);
     gfx.DrawString("Modelname: " + activeDiagram.Model.Name, font, XBrushes.Black, 
                     new XRect(50, 5, 400, 20), XStringFormats.TopLeft);
    gfx.DrawString("Modeltyp: " + typ, font, XBrushes.Black, new XRect(50, 25, 400, 
                    20), XStringFormats.TopLeft);
    gfx.DrawLine(new XPen(XColor.FromKnownColor(XKnownColor.CornflowerBlue), 2), 20, 
                    45, 600, 45);

   gfx.DrawLine(new XPen(XColor.FromKnownColor(XKnownColor.CornflowerBlue), 2), 20, 
                    900, 600, 900);
   gfx.DrawString("Date: " + DateTime.Now.ToShortDateString(), font2, XBrushes.Black, 
                    new XRect(50, 905, 100, 25), XStringFormats.TopLeft);
   gfx.DrawString("Page: 1 von 1 ", font2, XBrushes.Black, new XRect(530, 905, 100, 
                25), XStringFormats.TopLeft);

    SaveFileDialog dlg = new SaveFileDialog();
    lg.FileName = activeDiagram.Model.Name;
    dlg.AddExtension = true;
    dlg.DefaultExt = "pdf";
    dlg.Filter = "PDF Document|*.pdf|*.pdf|";
    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
                // Save the document...
                string filename = dlg.FileName;
                document.Save(filename);
                // ...and start a viewer.
                Process.Start(filename);
            }
        }
        catch (Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.Message, "Error saving graph as a 
             pdf");
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:19:47+00:00Added an answer on June 10, 2026 at 9:19 am

    Creating multiple pages with PDFsharp is simple – but PDFsharp is not prepared to distribute your bitmap accross several pages, so this task is left to you.

    Depending on the size of the bitmap, your code should decide to cut the image into two or four parts and draw them on two or four pages. This way you don’t have to rely onto the capabilities of a printer driver.

    PDFsharp can create larger pages – but then you’d have to rely onto the capabilities of the printer driver to print a single PDF page onto several physical pages. That may or may not work.

    If you split the image yourself, you have full control of the PDF file that comes out. I’d recommend having the two or four segments printed with a common (overlapping) strip.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are creating PDF documents on the fly from the database using PDFsharp .
I am using PdfSharp dll to print a pdf. This is the code that
I am using PDFsharp / MigraDoc to write tables and charts to PDF files.
I have the following code: using System; using System.Diagnostics; using System.IO; using PdfSharp.Pdf.Printing; namespace
I am using PDFsharp to create PDF files in my C# application. It's working
I have a program that is manually generating a PDF using PDFsharp in C#.
I am successfully able to extract images from a pdf using pdfsharp. The image
I'm developing an application in c# using winforms and I need to print some
I am using PDFSharp to export a table to PDF (using the regular MigraDoc.DocumentObjectModel.Tables.Table
I am using an external DLL (pdfsharp) to open (then manipulate) lots of PDF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.