Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.
Thu Sep 15, 2016 9:05 pm
Hello,
My code:
- Code: Select all
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromFile(fileName);
doc.PrinterName = @"\xxxx\DYMO LabelWriter 4XL";
doc.PrintDocument.Print();
I am getting an exception:
An unhandled exception of type 'System.Drawing.Printing.InvalidPrinterException' occurred in System.Drawing.dll
Additional information: Settings to access printer '\xxxx\DYMO LabelWriter 4XL' are not valid.
I have verified the PDF file is valid.
What do I need to change for this to work?
-

jgittelson
-
- Posts: 4
- Joined: Thu Sep 15, 2016 8:21 pm
Fri Sep 16, 2016 4:07 am
Hello,
It is likely that the permission to printer is missing. Can you print to that printer using any other ways?
Thanks,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Fri Sep 16, 2016 3:05 pm
Hello Gary,
It is likely that the permission to printer is missing. Can you print to that printer using any other ways?
Yes, I am able to print to the printer using other methods.
-J
-

jgittelson
-
- Posts: 4
- Joined: Thu Sep 15, 2016 8:21 pm
Mon Sep 19, 2016 9:23 am
Hello,
Sorry for late reply as weekend. What's your application?
Thanks,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Mon Sep 19, 2016 2:34 pm
Gary,
>Sorry for late reply as weekend.
No worries, did not expect answer during weekend.
>What's your application?
????
I can print to the printer with Microsoft Word or Open Office.
-

jgittelson
-
- Posts: 4
- Joined: Thu Sep 15, 2016 8:21 pm
Wed Sep 21, 2016 2:16 pm
Gary,
I tried your suggestion and it did not help. I spent some more time googling this issue, and after trying many things, which did not work either, I noticed the typo in the code below.
- Code: Select all
doc.PrinterName = "\\xxxx\\DYMO LabelWriter 4XL";
It should read as below:
- Code: Select all
doc.PrinterName = "\\\\xxxx\\DYMO LabelWriter 4XL";
Thank you for trying to help, and sorry but this was a problem on my end.
-J
-

jgittelson
-
- Posts: 4
- Joined: Thu Sep 15, 2016 8:21 pm
Thu Sep 22, 2016 1:31 am
Hello,
Thank you for sharing the solution.
Please contact us if you have any questions.
Sincerely,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Fri Aug 28, 2020 7:00 pm
i know this is an old post but i am having the same issue. However, our printer is not configured \\print_server\printer_name it is configured \\printer_ip_address. would this still work for the PdfSettings.PrinterName setting. The following is the code i am using from the example on your site.
PdfDocument pdfdocument = new PdfDocument();
pdfdocument.LoadFromFile(sPdfFile);
pdfdocument.PrintSettings.PrinterName = printername;
pdfdocument.PrintSettings.Copies = 1;
pdfdocument.Print();
pdfdocument.Dispose();
-

[email protected]
-
- Posts: 5
- Joined: Tue Dec 13, 2011 8:01 pm
Mon Aug 31, 2020 8:23 am
Hi Jason,
Yes, specifying the printer by IP address is also supported. Below code is for your reference. If there is any question, please feel free to contact us.
- Code: Select all
// pdf.PrintSettings.PrinterName = @"\\printer_ip_address\printer_name";
pdf.PrintSettings.PrinterName = @"\\192.168.1.104\HP LaserJet P1007";
Sincerely,
Elena
E-iceblue support team
-


Elena.Zhang
-
- Posts: 279
- Joined: Thu Jul 23, 2020 1:18 am