---
title: "How to print a PDF in C# with Nutrient"
canonical_url: "https://www.nutrient.io/blog/how-to-print-pdf-in-csharp/"
md_url: "https://www.nutrient.io/blog/how-to-print-pdf-in-csharp.md"
last_updated: "2026-08-04T17:20:06.541Z"
description: "Learn how to print PDFs programmatically in C# using Nutrient."
---

**TL;DR**

This tutorial demonstrates how to implement PDF printing functionality in C# applications using Nutrient’s.NET PDF SDK. The guide walks through project setup in Visual Studio, integration of the GdPicture.NET library, and implementation of PDF and image printing capabilities with customizable printer settings. The solution provides a straightforward approach to programmatic PDF printing without requiring external dependencies.

In this post, you’ll learn how to use Nutrient’s [.NET PDF SDK](https://www.nutrient.io/sdk/dotnet/) to print PDFs for your C# application.

To get started, you’ll set up a new C# project and open a project in Visual Studio. Then, you’ll learn how to print a PDF using the Nutrient GdPicture.NET library in your project.

## Nutrient’s C#.NET PDF library

Nutrient’s GdPicture.NET library is a complete SDK that supports:

- [OCR](https://www.nutrient.io/guides/dotnet/ocr.md)

- [Data extraction](https://www.nutrient.io/sdk/ai-document-processing/)

- [Barcode scanning](https://www.nutrient.io/guides/dotnet/barcodes.md)

- [Document conversion](https://www.nutrient.io/guides/dotnet/conversion.md)

- [PDF generation](https://www.nutrient.io/guides/dotnet/pdf-generation.md)

- Many more [image and document-related tasks](https://www.nutrient.io/guides/dotnet.md)

GdPicture.NET also supports more than 100 file formats and abstracts all of its powerful features behind a rich, cross-platform, and easy-to-use API to maximize developer productivity.

## Requirements

To get started, you’ll need the following:

- Visual studio — The official integrated development environment for C#.NET.

## Getting started with Nutrient

The next sections will provide you with information on how to first create a new project and then prepare a PDF for printing using C#.

### Creating a new project

1. Open Visual Studio and create a new project. Then specify your project requirements.

2. Choose the correct template for your project. For this example, you’ll use **Console App**.![Image showing a menu in Visual Studio that lets user choose a template](@/assets/images/blog/2024/how-to-print-pdf-in-csharp/choose-template.png)

3. When prompted, choose your project name (**Nutrient PDF Demo**), select the location where you want to save the project, and press **Next**. Then select the target.NET framework.![Image showing to add a name and location](@/assets/images/blog/2024/how-to-print-pdf-in-csharp/configure-name.png)

4. Click **Create** to create your project at your preferred save location.

### Adding Nutrient’s PDF library to your project

1. Add the Nutrient GdPicture library from the NuGet solution manager. Select the project and install that library into the project.![Image showing to add a GdPicture from the NuGet solution manager](@/assets/images/blog/2024/how-to-print-pdf-in-csharp/install-package.png)

2. Add the Nutrient dependency in the `Program.cs` file using GdPicture14.

### Building the project

Once you’ve added the libraries mentioned above into the project and added the library reference into the current file, build the project and ensure that all solutions build successfully.

### Printing a PDF document

Next, you’ll open a PDF file from the device’s local storage using the following code:

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
// Load the source document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Store the handle of the active window in a variable.
IntPtr WINDOW_HANDLE = IntPtr.Zero;
// Enable the printer settings dialog.
gdpicturePDF.PrintShowPrinterSettingsDialog(WINDOW_HANDLE);
// Print the document.
gdpicturePDF.Print();
// Release unnecessary resources.
gdpicturePDF.CloseDocument();

```

The code above will first create the `GdPicturePDF` object, and based on that, the file will be opened. If the file is opened successfully, the active window will be handled in the `WINDOW_HANDLE` variable. Then, call the `PrintShowPrinterSettingsDialog` function using the `GdPicturePDF` object.

Afterward, call the print function to print the loaded PDF to the PDF viewer tool or browser. The output of the code above is shown in the following image.![Image showing the solution of the above code](@/assets/images/blog/2024/how-to-print-pdf-in-csharp/pdf.png)

### Printing an image

The `GdPictureImaging` class will display the images and then print for you. Below is the code for viewing the file using the `GdPictureImaging` class:

```csharp

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source image.
int imageId = gdpictureImaging.CreateGdPictureImageFromFile(@"C:\temp\source.png");
// Store the handle of the active window in a variable.
IntPtr WINDOW_HANDLE = IntPtr.Zero;
// Enable the printer settings dialog.
gdpictureImaging.PrintShowPrinterSettingsDialog(WINDOW_HANDLE);
// Print the image.
gdpictureImaging.Print(imageId);
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);

```

## FAQ

#### How do I print a PDF in C#?

Open the PDF with Nutrient’s GdPicture.NET `GdPicturePDF` class. Then call its print method to send the document to a printer. GdPicture.NET handles rendering and printing natively, so no external print library is required.

#### Can I print a PDF in C# without showing the printer dialog?

Yes. Instead of calling `PrintShowPrinterSettingsDialog`, configure the printer name, page range, and other settings programmatically. Then print directly. This is useful for silent or server-side printing.

#### Can I print images as well as PDFs?

Yes. The `GdPictureImaging` class prints image files (such as TIFF, PNG, and JPEG) using the same approach shown for PDFs.

## Conclusion

This post demonstrated how to print a PDF in C# using Nutrient’s GdPicture.NET library. If you hit any snags, don’t hesitate to [reach out](https://www.nutrient.io/support/request) to our Support team for help.

At Nutrient, we offer a commercial, feature-rich, and completely customizable web PDF library that’s easy to integrate and comes with well-documented APIs to handle advanced use cases. [Try](https://www.nutrient.io/try) it for free, or visit [our demo](https://www.nutrient.io/demo) to see it in action.
---

## Related pages

- [The business case for accessibility: Five ways it drives enterprise value](/blog/5-ways-accessibility-drives-enterprise-value.md)
- [Accessibility Untangled Why It Matters Guide](/blog/accessibility-untangled-why-it-matters-guide.md)
- [Advanced Techniques For React Native Ui Components](/blog/advanced-techniques-for-react-native-ui-components.md)
- [`vector_store` holds your indexed documents (see the multimodal RAG post](/blog/agentic-rag.md)
- [Ai Document Automation Extraction To Action](/blog/ai-document-automation-extraction-to-action.md)
- [Ai Legal Assistant Document Authoring](/blog/ai-legal-assistant-document-authoring.md)
- [Angular File Viewer Pdf Image Office Files](/blog/angular-file-viewer-pdf-image-office-files.md)
- [Auto Tagging And Document Accessibility In Dotnet Sdk](/blog/auto-tagging-and-document-accessibility-in-dotnet-sdk.md)
- [Best Document Viewers](/blog/best-document-viewers.md)
- [The CEO’s AI playbook: Why decision architecture beats model selection](/blog/ceo-ai-playbook-decision-architecture.md)
- [1. Extract and chunk the PDF.](/blog/chat-with-pdf.md)
- [Complete Guide To Pdfjs](/blog/complete-guide-to-pdfjs.md)
- [Construction Document Data Extraction](/blog/construction-document-data-extraction.md)
- [Convert One Drive Files To Pdf In Sharepoint](/blog/convert-one-drive-files-to-pdf-in-sharepoint.md)
- [Create And Edit Pdfs In Flutter](/blog/create-and-edit-pdfs-in-flutter.md)
- [Create Pdfs With React](/blog/create-pdfs-with-react.md)
- [Creating A Document Scanner With Ocr In Python](/blog/creating-a-document-scanner-with-ocr-in-python.md)
- [Creating And Filling Pdf Forms Programmatically In Javascript](/blog/creating-and-filling-pdf-forms-programmatically-in-javascript.md)
- [The CTO’s AI playbook: Why accountability architecture beats orchestration](/blog/cto-ai-playbook-accountability-architecture.md)
- [Digital Signatures](/blog/digital-signatures.md)
- [Digital Workflow Automation](/blog/digital-workflow-automation.md)
- [Document Ai Vs Ocr](/blog/document-ai-vs-ocr.md)
- [Document Extraction Confidence Scores](/blog/document-extraction-confidence-scores.md)
- [Document Viewer](/blog/document-viewer.md)
- [Document Watermarking](/blog/document-watermarking.md)
- [Emerging threats: Your logging system may be an agentic threat vector](/blog/emerging-threats-your-logging-system.md)
- [app.py](/blog/extract-text-from-pdf-using-python.md)
- [Fillable Pdf](/blog/fillable-pdf.md)
- [How To Add Digital Signature To Pdf Using React](/blog/how-to-add-digital-signature-to-pdf-using-react.md)
- [How To Build A Dotnet Maui Pdf Viewer](/blog/how-to-build-a-dotnet-maui-pdf-viewer.md)
- [How To Build A Flutter Pdf Viewer](/blog/how-to-build-a-flutter-pdf-viewer.md)
- [or](/blog/how-to-build-a-javascript-pdf-viewer-with-pdfjs.md)
- [How To Build A Javascript Pdf Viewer](/blog/how-to-build-a-javascript-pdf-viewer.md)
- [or](/blog/how-to-build-a-nextjs-pdf-viewer.md)
- [How To Build A Powerpoint Viewer Using Javascript](/blog/how-to-build-a-powerpoint-viewer-using-javascript.md)
- [Using Yarn](/blog/how-to-build-a-react-excel-viewer.md)
- [How To Build A React Native Pdf Viewer](/blog/how-to-build-a-react-native-pdf-viewer.md)
- [How To Build A React Powerpoint Viewer](/blog/how-to-build-a-react-powerpoint-viewer.md)
- [How To Build A Reactjs File Viewer](/blog/how-to-build-a-reactjs-file-viewer.md)
- [or](/blog/how-to-build-a-reactjs-pdf-viewer-with-react-pdf.md)
- [or](/blog/how-to-build-a-reactjs-pdf-viewer.md)
- [How To Build A Reactjs Viewer With Pdfjs](/blog/how-to-build-a-reactjs-viewer-with-pdfjs.md)
- [How To Build A Vuejs Pdf Viewer With Pdfjs](/blog/how-to-build-a-vuejs-pdf-viewer-with-pdfjs.md)
- [How To Build A Vuejs Pdf Viewer](/blog/how-to-build-a-vuejs-pdf-viewer.md)
- [How To Build An Android Pdf Viewer](/blog/how-to-build-an-android-pdf-viewer.md)
- [How To Build An Angular Pdf Viewer With Ng2 Pdf Viewer](/blog/how-to-build-an-angular-pdf-viewer-with-ng2-pdf-viewer.md)
- [How To Build An Angular Pdf Viewer With Pdfjs](/blog/how-to-build-an-angular-pdf-viewer-with-pdfjs.md)
- [How To Convert Docx To Pdf Using Javascript](/blog/how-to-convert-docx-to-pdf-using-javascript.md)
- [How To Convert Docx To Pdf Using Python](/blog/how-to-convert-docx-to-pdf-using-python.md)
- [How To Convert Html To Pdf Using Html2pdf](/blog/how-to-convert-html-to-pdf-using-html2pdf.md)
- [or](/blog/how-to-convert-html-to-pdf-using-react.md)
- [How To Convert Html To Pdf Using Wkhtmltopdf And Csharp](/blog/how-to-convert-html-to-pdf-using-wkhtmltopdf-and-csharp.md)
- [or](/blog/how-to-convert-html-to-pdf-using-wkhtmltopdf-and-python.md)
- [How To Convert Word To Pdf In Nodejs](/blog/how-to-convert-word-to-pdf-in-nodejs.md)
- [or](/blog/how-to-create-a-react-js-signature-pad.md)
- [How To Create Pdfs With React To Pdf](/blog/how-to-create-pdfs-with-react-to-pdf.md)
- [How To Edit Pdfs Using Ios Pdf Library](/blog/how-to-edit-pdfs-using-ios-pdf-library.md)
- [How To Embed A Pdf Viewer In Your Website](/blog/how-to-embed-a-pdf-viewer-in-your-website.md)
- [How To Extract Tables From Pdf And Images](/blog/how-to-extract-tables-from-pdf-and-images.md)
- [How To Generate Pdf From Html With Nodejs](/blog/how-to-generate-pdf-from-html-with-nodejs.md)
- [base_url tells WeasyPrint where to resolve relative asset paths](/blog/how-to-generate-pdf-reports-from-html-in-python.md)
- [How To Merge Pdfs Using Javascript](/blog/how-to-merge-pdfs-using-javascript.md)
- [How To Ocr Pdfs In Linux](/blog/how-to-ocr-pdfs-in-linux.md)
- [Open an image.](/blog/how-to-use-tesseract-ocr-in-python.md)
- [From an HTML string.](/blog/html-in-pdf-format.md)
- [Javascript Pdf Editors](/blog/javascript-pdf-editors.md)
- [Javascript Pdf Libraries](/blog/javascript-pdf-libraries.md)
- [Linearized Pdf](/blog/linearized-pdf.md)
- [or](/blog/merge-pdfs.md)
- [Swift Package Manager](/blog/mobile-pdf-sdk.md)
- [`elements` come from your document parser — each has a type and content.](/blog/multimodal-rag.md)
- [Nutrient Vs Conga Composer](/blog/nutrient-vs-conga-composer.md)
- [Online Document Viewer](/blog/online-document-viewer.md)
- [Open Pdf In Your Web App](/blog/open-pdf-in-your-web-app.md)
- [Building WCAG 2.2, Section 508, and PDF/UA-compliant PDFs with an SDK](/blog/pdf-accessibility.md)
- [Pdf Extraction Benchmark Opendataloader Bench](/blog/pdf-extraction-benchmark-opendataloader-bench.md)
- [Pdf Extraction Document Case Studies](/blog/pdf-extraction-document-case-studies.md)
- [Pdf Page Labels](/blog/pdf-page-labels.md)
- [Pdf Sdk Compliance Security Checklist](/blog/pdf-sdk-compliance-security-checklist.md)
- [Pdf Sdk Performance Benchmark](/blog/pdf-sdk-performance-benchmark.md)
- [Pdf Ua Compliance Guide](/blog/pdf-ua-compliance-guide.md)
- [Pdfjs Accessibility Structtree Printing](/blog/pdfjs-accessibility-structtree-printing.md)
- [Pdfjs Advanced Loading Streaming Workers](/blog/pdfjs-advanced-loading-streaming-workers.md)
- [Pdfjs Annotation Editor Layer](/blog/pdfjs-annotation-editor-layer.md)
- [Pdfjs Area Annotations Canvas Capture](/blog/pdfjs-area-annotations-canvas-capture.md)
- [Pdfjs Coordinate Systems Pdf To Screen](/blog/pdfjs-coordinate-systems-pdf-to-screen.md)
- [Pdfjs Document Outline Bookmarks Metadata](/blog/pdfjs-document-outline-bookmarks-metadata.md)
- [Pdfjs Eventbus Guide](/blog/pdfjs-eventbus-guide.md)
- [Pdfjs Limitations Commercial Upgrade](/blog/pdfjs-limitations-commercial-upgrade.md)
- [Pdfjs Native Annotation Layer Forms](/blog/pdfjs-native-annotation-layer-forms.md)
- [Pdfjs Navigation Zoom Rotation](/blog/pdfjs-navigation-zoom-rotation.md)
- [Pdfjs Pdf Page Manipulation Pdf Lib](/blog/pdfjs-pdf-page-manipulation-pdf-lib.md)
- [Pdfjs React Viewer Setup](/blog/pdfjs-react-viewer-setup.md)
- [Pdfjs Rendering Overlays React Portals](/blog/pdfjs-rendering-overlays-react-portals.md)
- [Pdfjs Server Side Text Extraction](/blog/pdfjs-server-side-text-extraction.md)
- [Pdfjs Sticky Note Annotations](/blog/pdfjs-sticky-note-annotations.md)
- [Pdfjs Text Highlight Annotations](/blog/pdfjs-text-highlight-annotations.md)
- [Pdfjs Text Search Pdffindcontroller](/blog/pdfjs-text-search-pdffindcontroller.md)
- [Pdfjs Thumbnail Sidebar](/blog/pdfjs-thumbnail-sidebar.md)
- [Process Flows](/blog/process-flows.md)
- [React Native Pdf Annotation](/blog/react-native-pdf-annotation.md)
- [Using Yarn](/blog/react-pdf-editor.md)
- [or](/blog/sample-blog-updated.md)
- [Add DWS MCP Server to your Claude Code project.](/blog/teaching-llms-to-read-pdfs.md)
- [Open an image file.](/blog/tesseract-python-guide.md)
- [Define the HTML part of the document.](/blog/top-10-ways-to-generate-pdfs-in-python.md)
- [Top 5 Javascript Pdf Viewers](/blog/top-5-javascript-pdf-viewers.md)
- [or](/blog/top-js-pdf-libraries.md)
- [Convert an HTML file to PDF.](/blog/top-ten-ways-to-convert-html-to-pdf.md)
- [Vector Pdf](/blog/vector-pdf.md)
- [Wcag2 Accessibility Requirements Documents](/blog/wcag2-accessibility-requirements-documents.md)
- [Web Sdk Is Now Headless](/blog/web-sdk-is-now-headless.md)
- [What Are Annotations](/blog/what-are-annotations.md)
- [What Is A Vpat](/blog/what-is-a-vpat.md)
- [What Is Document Processing](/blog/what-is-document-processing.md)
- [What Is Intelligent Document Processing](/blog/what-is-intelligent-document-processing.md)
- [What Is Pdf Ua](/blog/what-is-pdf-ua.md)
- [Why Pdfium Is A Trusted Platform For Pdf Rendering](/blog/why-pdfium-is-a-trusted-platform-for-pdf-rendering.md)
- [Why Your Ai Agent Hallucinates Pdf Table Data](/blog/why-your-ai-agent-hallucinates-pdf-table-data.md)

