---
title: "Print something that is not shown on the screen using wpf."  
description: "Print something that is not shown on the screen using wpf."  
author: "Anonymous User"  
published: 2013-08-16  
updated: 2014-03-07  
canonical: https://www.mindstick.com/forum/1382/print-something-that-is-not-shown-on-the-screen-using-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 2 minutes  

---

# Print something that is not shown on the screen using wpf.

Hi [Developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs)!

How does [word](https://www.mindstick.com/forum/305/read-word-file) [print](https://www.mindstick.com/blog/301752/types-of-3d-printing-technology) all the [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) of the [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page)? what is the [mechanism](https://www.mindstick.com/interview/1317/what-is-a-freezable)? I just need a head start , how to print something that is not shown on the [screen](https://www.mindstick.com/forum/33644/loading-screen-during-ajax-call)?

thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)

## Replies

### Reply by Ely Sanders

Hi, if you were referring to MS Word, it uses a C# word interop to manipulate with a content and to print it.For your WPF application you need to use System.Printing namespace and its classes like PrintQueue and PrintTicket. You can read about it on [MSDN Printing Overview](http://msdn.microsoft.com/en-us/library/ms742418(v=vs.110).aspx).

### Reply by shreesh chandra shukla

Hi!

Im not sure if this is what you want but,

What you have to do is create a dummy form that's the size of the control you want to print then add the control to the dummy form and show the form and print the control on the dummy.

Here is how i did it:

```
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e){    //Create bitmap    Bitmap image = new Bitmap(dataGridView1.Width, dataGridView1.Height);    //Create form    Form f = new Form();    //add datagridview to the form    f.Controls.Add(dataGridView1);    //set the size of the form to the size of the datagridview    f.Size = dataGridView1.Size;    //draw the datagridview to the bitmap    dataGridView1.DrawToBitmap(image, new Rectangle(0, 0, dataGridView1.Width, dataGridView1.Height));    //dispose the form    f.Dispose();    //print    e.Graphics.DrawImage(image, 0, 0);}
```

This will print dataGridView1, even if its not seen on the form.


---

Original Source: https://www.mindstick.com/forum/1382/print-something-that-is-not-shown-on-the-screen-using-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
