Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - getprintername() question
  FAQ FAQ  Forum Search   Register Register  Login Login

getprintername() question

 Post Reply Post Reply
Author
Message
quickpdf_learner View Drop Down
Beginner
Beginner


Joined: 15 Oct 10
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote quickpdf_learner Quote  Post ReplyReply Direct Link To This Post Topic: getprintername() question
    Posted: 02 Nov 10 at 7:28PM
I am trying to get the printer name out of the web application and got different results.
My method is:

PDFLibrary qp = new PDFLibrary(Server.MapPath("~\\QuickPDFDLL0721.dll"));

if (qp.LibraryLoaded())

{

// Check the license key

if (qp.UnlockKey("XXXXXXXX") == 1)

{

string pn = qp.GetDefaultPrinterName();
 
}
 
 
1) publish to local, everything is fine.
2) publish to web server (windows server 2003, iis6), only get "Microsoft XPS Document Writer" as the result.
3) publish to web server (windows server 2008, iis7), receive error message: "NullReferenceException: Object reference not set to an instance of an object.]
   _Default.Page_Load(Object sender, EventArgs e) +229
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627"
 
Actually all the machines have the same default printer (which is not Microsoft XPS Document Writer).
 
Forgive me if I am dumb, I already searched the forum and didn't find any same questions.
 

 
 
Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 10 at 10:46PM
First, not knowing about how IIS is works, what I say next might be off base.  So in case you don't know, printers are user specific. So 2 different users on the same computer can have different printers and defaults installed. The reason I mention this is because it sounds like the service is using a different user than whoever is logged onto the computer. So, if a service uses "local system account" as its log on option, their is now way to set the printers for this user. Setting the log on option for the service to a user will allow access to that user's printers. But to get the printers for the currently logged on user will require working on the privilidges I believe.

I hope this helps somehow. At least you will better understand how printers work with services.
Wheeley
Ouch
Back to Top
Dimitry View Drop Down
Team Player
Team Player


Joined: 18 Feb 10
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitry Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 10 at 1:43AM
GetDefaultPrinterName() should return default printer name and GetPrinterNames() - all installed printers.
Can you please check the following positions:
1. What version of Windows 2008 do you use: x86 or x64?
2. What is you system language?
3. Please make sure that library is loaded and can be properly accessed.
For example try to simply check qp.LibraryVersion(). If this causes an error, make sure that you use proper library path.
 
Hope to hear news from you soon.
Regards,
Dmitry
Back to Top
quickpdf_learner View Drop Down
Beginner
Beginner


Joined: 15 Oct 10
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote quickpdf_learner Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 10 at 12:42PM
1) local: windows 7 x86, web server: windows 2008 x86 (error seen), windows 2003 x86 (return "Microsoft XPS Document Writer" as default printer which is not).
2) System language: English.
3) Library is loaded well cause other methods work fine.
 
Thanks, I wll check as what Wheeley said.
 
Back to Top
quickpdf_learner View Drop Down
Beginner
Beginner


Joined: 15 Oct 10
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote quickpdf_learner Quote  Post ReplyReply Direct Link To This Post Posted: 04 Nov 10 at 4:20PM
I have to bring up another question. How to use NewCustomPrinter(string printername)?
 
For example, the printer name I want to use is \\abc\IT HP M100 (I get it by using GetPrinterNames method), I get a long string like "F5C4BC4E2DA9D72F39144815BA862ABC" after I pass it to the method.
 
Any help is appreciated.
Back to Top
quickpdf_learner View Drop Down
Beginner
Beginner


Joined: 15 Oct 10
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote quickpdf_learner Quote  Post ReplyReply Direct Link To This Post Posted: 04 Nov 10 at 8:56PM
Some progress:
This works for server 2003 with iis6, while still doesn't work for server 2008 with iis7.
 
 
Originally posted by quickpdf_learner quickpdf_learner wrote:

I have to bring up another question. How to use NewCustomPrinter(string printername)?
 
For example, the printer name I want to use is \\abc\IT HP M100 (I get it by using GetPrinterNames method), I get a long string like "F5C4BC4E2DA9D72F39144815BA862ABC" after I pass it to the method.
 
Any help is appreciated.
Back to Top
Dimitry View Drop Down
Team Player
Team Player


Joined: 18 Feb 10
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitry Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 10 at 2:18PM
Originally posted by quickpdf_learner quickpdf_learner wrote:

I have to bring up another question. How to use NewCustomPrinter(string printername)?
 
For example, the printer name I want to use is \\abc\IT HP M100 (I get it by using GetPrinterNames method), I get a long string like "F5C4BC4E2DA9D72F39144815BA862ABC" after I pass it to the method.
 
Any help is appreciated.
 
NewCustomPrinter() returns a formal printer name that can be used with such functions as SetupCustomPrinter() and PrintDocument().
"F5C4BC4E2DA9D72F39144815BA862ABC" - looks like a valid custom printer name.


Edited by Dimitry - 08 Nov 10 at 2:18PM
Regards,
Dmitry
Back to Top
quickpdf_learner View Drop Down
Beginner
Beginner


Joined: 15 Oct 10
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote quickpdf_learner Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 10 at 2:46PM
Thank you, Dimitry.
 
I think I found a workaround. Since I am testing the same network printer on different servers, I use the long string  "F5C4BC4E2DA9D72F39144815BA862ABC" generated from server 2003 iis 6 and passed it to printdocument() method on server 2008 iis7, it did work fine!
 
 
Originally posted by Dimitry Dimitry wrote:

Originally posted by quickpdf_learner quickpdf_learner wrote:

I have to bring up another question. How to use NewCustomPrinter(string printername)?
 
For example, the printer name I want to use is \\abc\IT HP M100 (I get it by using GetPrinterNames method), I get a long string like "F5C4BC4E2DA9D72F39144815BA862ABC" after I pass it to the method.
 
Any help is appreciated.
 
NewCustomPrinter() returns a formal printer name that can be used with such functions as SetupCustomPrinter() and PrintDocument().
"F5C4BC4E2DA9D72F39144815BA862ABC" - looks like a valid custom printer name.
Back to Top
Dimitry View Drop Down
Team Player
Team Player


Joined: 18 Feb 10
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitry Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 10 at 2:52PM

Glad to hear that you found the solution.

So using NewCustomPrinter() helped you with PrintDocument() on server 2008 IIS7?
Regards,
Dmitry
Back to Top
quickpdf_learner View Drop Down
Beginner
Beginner


Joined: 15 Oct 10
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote quickpdf_learner Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 10 at 2:35PM
Yes, and it works fine if you define the printer as //printerservername/printername.
 
Originally posted by Dimitry Dimitry wrote:

Glad to hear that you found the solution.

So using NewCustomPrinter() helped you with PrintDocument() on server 2008 IIS7?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store