Printing PDFs Silently in C#

This guide explains how to print a PDF document or an image silently with GdPicture.NET SDK.

Information

Printing and scanning aren’t supported in the cross-platform .NET 6.0 assembly. For more information, see the system compatibility guide.

Printing a PDF Document

To print a PDF document silently, follow these steps:

  1. Create a GdPicturePDF object.

  2. Load the source document by passing its file path to the LoadFromFile method.

  3. Optional: Configure the printing process programmatically. For more information, see the configuring printing guide.

  4. Print the document with the Print method.

  5. Release unnecessary resources.

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
// Load the source document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Print the document.
gdpicturePDF.Print();
// Release unnecessary resources.
gdpicturePDF.CloseDocument();
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    ' Load the source document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Print the document.
    gdpicturePDF.Print()
    ' Release unnecessary resources.
    gdpicturePDF.CloseDocument()
End Using
Used Methods

Related Topics

Printing an Image

To print an image silently, follow these steps:

  1. Create a GdPictureImaging object.

  2. Load the source document by passing its file path to the CreateGdPictureImageFromFile method.

  3. Optional: Configure the printing process programmatically. For more information, see the configuring printing guide.

  4. Print the image with the Print method.

  5. Release unnecessary resources.

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source image.
int imageId = gdpictureImaging.CreateGdPictureImageFromFile(@"C:\temp\source.png");
// Print the image.
gdpictureImaging.Print(imageId);
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Load the source image.
    Dim imageId As Integer = gdpictureImaging.CreateGdPictureImageFromFile("C:\temp\source.png")
    ' Print the image.
    gdpictureImaging.Print(imageId)
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
End Using
Used Methods

Related Topics