facebooktwittermenuarrow-up

GemBox Support Forum

Set job name in print queue when printing a pdf

I am trying to print a pdf document using Gembox.Pdf in C# (.NET Framework 4.8). This is the code I use:

public void PrintPdf(string fileToPrint, string printerName, string jobName)
{
  ComponentInfo.SetLicense("FREE-LIMITED-KEY");
  using (var document = PdfDocument.Load(fileToPrint))
  {
    document.Print(printerName, new PrintOptions
    {
      DocumentName = jobName
    });
  }
}

It doesn’t matter what I pass as jobName, when I look at the print queue I always see ‘Xps Document’. I am using the free version of Gembox.Pdf for now.

Hi,

The DocumentName property was introduced for naming the printed document in some virtual printers (like Bullzip PDF).

But anyway, I’m afraid that currently there is no stable way to achieve this task.
You see, the problem is that System.Printing doesn’t offer a consistent solution for this task.

The closest solution that I got was with PrintSystemJobInfo.JobName and JobName.Commit, but it failed on more printers than it succeeded.

I’m afraid that in order to provide support for this we’ll need to replace the WPF implementation with something else (like GDI+ implementation from System.Drawing.Printing or some other alternative).

We have an internal support ticket for this and I have added your report to it as well.
However, please note that this re-factoring requires quite a large time investment, which is why unfortunately, it won’t be done any time soon.

Regards,
Mario

Hi Bart,

This issue should now be resolved with this bugfix:
https://www.gemboxsoftware.com/pdf/nightlybuilds/GBA15v1156.zip

Or this NuGet package:
Install-Package GemBox.Pdf -Version 15.0.1156-hotfix

Regards,
Mario