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 8312435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:09:47+00:00 2026-06-08T20:09:47+00:00

I am creating a PDF File in my application, and then I print it

  • 0

I am creating a PDF File in my application, and then I print it (works fine.)

When I print this pdf on another computer/Printer it doesn’t look the same! I want it so that it always looks the same, on whichever printer I print on.

Maybe I have to set the borders? Like this:

PrinterSettings ps = new PrinterSettings();
ps.DefaultPageSettings.HardMarginX = 0;
ps.DefaultPageSettings.HardMarginY = 0;

But HardMargin is not writable. Have you guys got some ideas?

  • 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-08T20:09:49+00:00Added an answer on June 8, 2026 at 8:09 pm

    Try to set up this way:

     PrintDocument printDocument1 = new PrintDocument();
    
            var printerSettings = new System.Drawing.Printing.PrinterSettings();
            printerSettings.PrinterName = "Printer name";// optional
            //printerSettings.PrinterName = "HP Officejet J6400 series";
    
            printDocument1.PrinterSettings = printerSettings;
    
            printDocument1.PrintPage += printDocument1_PrintPage;
            PrintDialog printDialog1 = new PrintDialog();
            printDialog1.Document = printDocument1;
    // in the dialog, you can set up the paper size, etc.
            printDialog1.UseEXDialog = true;
            if (printDialog1.ShowDialog() == DialogResult.OK)
            {
            printDocument1.Print();
            }
    

    Handler function:

    private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
    //This print form a rich textbox, but you can render pdf here.
            //e.Graphics.DrawString(richTextBox1.Text, richTextBox1.Font, Brushes.Black, 100, 20);
            //e.Graphics.PageUnit = GraphicsUnit.Inch;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried creating a pdf file out of another one(in my local drive) using
I am creating a file pdf in iphone application and it is saved in
In a Java web application I am creating a zip file from various in-memory
I am trying to silent print PDF files from within a java application (more
I am creating a PDF file from raw binary data and it's working perfectly
After creating a PDF file in PHP Using DOMPDF, I need to redirect user
I tried creating a pdf file into my device out of a file in
I'm creating PDF invoices in a C# MVC application that I'm attaching to an
I am working on creating thumbnail image from the first page of pdf file.
Hi I am embedding pdf file to my asp.net page like this <object data=...

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.