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 - Not able to print PDF from a windows service
  FAQ FAQ  Forum Search   Register Register  Login Login

Not able to print PDF from a windows service

 Post Reply Post Reply
Author
Message
Garima.Arya View Drop Down
Beginner
Beginner


Joined: 15 Feb 10
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Garima.Arya Quote  Post ReplyReply Direct Link To This Post Topic: Not able to print PDF from a windows service
    Posted: 15 Feb 10 at 6:43AM


Hi,

I am using trial version of Quick PDF Library to print PDF files from a .net 3.5 windows service running on 64 bit window server 2008 machine.

I have written following code to do so:

// Create an instance of the class and give it the path to the DLL
PDFLibrary qp
    = new PDFLibrary(ConfigurationManager.AppSettings["QuickPDFLibraryPath"]);
// Check if the DLL was loaded successfully
if (qp.LibraryLoaded())
{
    // Include and check the validity of the license key
    if (qp.UnlockKey(ConfigurationManager.AppSettings["QuickPDFLibraryKey"]) == 1)
    {
        qp.LoadFromFile(fileName);
        int printOptions = qp.PrintOptions(1, 0, "");
        string printerName = ConfigurationManager.AppSettings["PrinterName"];
        int pageCount = qp.PageCount();
        qp.PrintDocument(printerName, 1, pageCount, printOptions);
    }
}

This code works fine on our dev and QA environment. But when I tried to run it on one of our client machines (I just wanted to ensure that it works there before asking my client to buy this tool), it was not working. It was neither giving any error nor firing the print command on the printer.

Please help.

Thanks,
Garima

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 10 at 6:27AM
Hi Garima!

Perhaps there are few specialities with the printer name on the client machine?
Are you sure using the correct name?
Quotations, spaces, ... there can be many problems.
Check which are the accessable printers in the environment with QP.GetPrinterNames().
Check what's the name of the standard printer with QP.GetDefaultPrinterName().

Cheers, Ingo

Back to Top
Garima.Arya View Drop Down
Beginner
Beginner


Joined: 15 Feb 10
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Garima.Arya Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 10 at 8:25AM

Thanks Ingo...

I checked the printer name and it is same as the one returned by GetPrinterNames() method.

I forgot to mention few points that might give you more insight into the problem.
1) I am using a network printer
2) This method works fine from Windows application.
3) On running this method from Windows service, it gets struck indefinitely (I even waited for more than an hour) while executing the following statement:
qp.PrintDocument(printerName, 1, pageCount, printOptions);
I have to restart the service after this call.

Thanks,
Garima

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 10 at 2:39PM
Hi Garima!

Read this:
http://www.quickpdf.org/forum/printocument-fails_topic1068_post5003.html?KW=printer+server#5003
Perhaps it helps.
Try the advanced searchfunctionality above. You'll find a lot regarding your case.

Cheers, Ingo
Back to Top
Garima.Arya View Drop Down
Beginner
Beginner


Joined: 15 Feb 10
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Garima.Arya Quote  Post ReplyReply Direct Link To This Post Posted: 17 Feb 10 at 9:55AM

Thanks Ingo....I went through the link provided by you. It talks about following problems:

1) Problem while printing large document file. Note that I am trying to print pdf document containing 1 page only.

2) Problem in printing while printer is in spooling mode. This could be the reason but when we tried to test it, printer was not doing any other processing.
 
However, I would definitly like to implement and test this approach. If possible, please send me the code snippet to do so using c#.
 
I have also gone through all the thread that have been created so far for "PrintDocument" and "print pdf" related issues. But I couldnot find any solution/pointer. Please direct me if you are talking about any specific thread.
 
Thanks,
Garima
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