Problem setting default printer running under IIS

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
DISystemer
User
Posts: 14
Joined: Fri Feb 18, 2005 2:23 pm
Location: Trondheim, Norway
Contact:

Problem setting default printer running under IIS

Post by DISystemer »

Hi

I'm developing a WCF service that clients should be able to send HTML and receivce a PDF-version of the HTML.
Problem right now is to set the "PDF-XChange 4.0" printer to be the default printer. I have downloaded a trial version of the PDF-XChange Pro 4 SDK but have no idea how to start. We already have purchased the PDF-XChange Drivers that my service will use to create the PDF.

Im working on a Windows 7 64-bit workstation with the PDF-Xchange drivers installed. My service is developed and debugged with Visual Studio 2010 and the WCF service is hosted/running in IIS 7. I'm using .NET Framework 4.0 and C#.

To sum up: How to set the default printer using the SDK? I have a reference to PDF-XChange V4.0 Type Library in my service project. Is that the way to go?

Thanks in advance!
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Problem setting default printer running under IIS

Post by John - Tracker Supp »

Hi,

Please see the C# example provided as I suspect this will answer all your questions - if you still have a specific question - once reviewed - please come back.

The example app is called : PDFdriverAPI

I also attach here for ease :)
Attachments
PDFdriverAPI.zip
(10.07 KiB) Downloaded 289 times
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
DISystemer
User
Posts: 14
Joined: Fri Feb 18, 2005 2:23 pm
Location: Trondheim, Norway
Contact:

Re: Problem setting default printer running under IIS

Post by DISystemer »

Hi

Thank you for your response and I can tell you the sample is working well as long as I'm in a WinForm or WPF. As I said in my first post this functionality is placed in code running as a service under IIS and it doesn't work. I dont get any exceptions, it runs without any problems, but default printer doesn't get changed. I guess this has something to do with permissions?

This is very easy for you to reproduce, but I may attach my sample code for ease? :-)

Looking forward to your response, thanks.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6901
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Problem setting default printer running under IIS

Post by Paul - Tracker Supp »

Hi,

please post your code in a zip archive so it is not automatically removed by the forum software and ensure there is no license info included in your code.

:-)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
DISystemer
User
Posts: 14
Joined: Fri Feb 18, 2005 2:23 pm
Location: Trondheim, Norway
Contact:

Re: Problem setting default printer running under IIS

Post by DISystemer »

Hi

Attached is a demo that you could use to reproduce the problem.

The zip-file contains three projects: service, web client and a WPF-stand-alone.

The stand-alone app is able to change default printer, the service is not.

Looking forward to hear from you Paul.
Attachments
PDFPrintService.zip
PDFPrintService
(696.11 KiB) Downloaded 270 times
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6901
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Problem setting default printer running under IIS

Post by Paul - Tracker Supp »

Hi DISystemer,

I have created a ticket with our dev team around this RT#1063: Problem setting default printer running under IIS

I won't actually be the one doing the investigation here, but I'm glad to have been able to help.

:-)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
FPP
User
Posts: 1
Joined: Fri May 20, 2011 12:46 pm

Re: Problem setting default printer running under IIS

Post by FPP »

Any updates to this issue?

I have the same problem running Win 7 64-bit and IIS7 using WCF service as a PrintService.

Thanks.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17947
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Problem setting default printer running under IIS

Post by Tracker Supp-Stefan »

Hello FPP,

I can see in the ticket that it has been assigned to a developer, but there is no further information on this case.
I am sure Paul will update you as soon as there are some further news on the case.

Best,
Stefan
sandarkhine
User
Posts: 5
Joined: Mon Apr 20, 2015 2:28 am

Re: Problem setting default printer running under IIS

Post by sandarkhine »

I am having the same problem too. I am not able to create below instance to create PDFPrinter to set it as default printer.

PXCComLib5.CPXCControlEx prnFactory = new PXCComLib5.CPXCControlEx();
PDFPrinter = (PXCComLib5.CPXCPrinter)prnFactory.get_Printer("", "Simple PDF-XChange 2012", "<REG CODE>", "<DEV CODE>");

I am converting words file and images to PDF for OCR from WCF Service which is hosted in IIS.

Has this issue been resolved?

Thanks in advance.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Problem setting default printer running under IIS

Post by Ivan - Tracker Software »

Can your WCF Service interact with desktop?
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
sandarkhine
User
Posts: 5
Joined: Mon Apr 20, 2015 2:28 am

Re: Problem setting default printer running under IIS

Post by sandarkhine »

I am not sure if I am answering your question. I have folder unzip function to D drive folder in my wcf service and I am able to do OCR for PDF files and saved them in D drive in the same wcf service. Thanks for your response.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17947
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Problem setting default printer running under IIS

Post by Tracker Supp-Stefan »

Hello sandarkhine,

So shall we consider this resolved if you got it working?

Regards,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Problem setting default printer running under IIS

Post by Ivan - Tracker Software »

Open properties of your service and check if the option shown below is checked:

Image
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
sandarkhine
User
Posts: 5
Joined: Mon Apr 20, 2015 2:28 am

Re: Problem setting default printer running under IIS

Post by sandarkhine »

Hi Ivan,

Where can I find the screen in your reply? I am using C# to write WCF service and hosted in IIS. This service will need to convert word and images to PDF file.

Hi Stefan,

The issue is not resolved yet.

I really hope to get it work. I have attached the error I encountered.

Thanks.
Attachments
pdfxchange.pdf
errors getting pdfprinter
(155.86 KiB) Downloaded 327 times
sandarkhine
User
Posts: 5
Joined: Mon Apr 20, 2015 2:28 am

Re: Problem setting default printer running under IIS

Post by sandarkhine »

Now, I can solve the problem by adding the following to web.config file.

<identity impersonate="true" userName="xxx" password="xxx" />

I am now able to set the default printer.

But I still cannot print word document as pdf in WCF service. I am printing as follow. It's working fine in windows form application project. Did I miss anything?

PXCComLib5.CPXCControlEx prnFactory = new PXCComLib5.CPXCControlEx();
PDFPrinter = (PXCComLib5.CPXCPrinter)prnFactory.get_Printer("", "Simple PDF-XChange 2012", "<REG CODE>", "<DEV CODE>");

PDFPrinter.Option["Save.ShowSaveDialog"] = true;
PDFPrinter.Option["Save.RunApp"] = true;
PDFPrinter.Option["Save.Path"] = pdfpath;
PDFPrinter.Option["Save.WhenExists"] = 1; //overwrite

System.Diagnostics.Process printJob = new System.Diagnostics.Process();
printJob.StartInfo.FileName = path + "\\" + Path.GetFileName(filename); // source word file path
printJob.StartInfo.UseShellExecute = true;
printJob.StartInfo.Verb = "print";
printJob.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
printJob.Start();

I am having below error at printJob.Start();

The server encountered an error processing the request. The exception message is 'An error occurred in sending the command to the application'. See server logs for more details. The exception stack trace is:

at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at

Thanks a lot.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Problem setting default printer running under IIS

Post by Ivan - Tracker Software »

As far as I remember, MS Word does not work properly under service in general circumstances.
There are some workarounds described. For example: http://www.verydoc.com/others/configure ... -excel.htm or https://support.microsoft.com/en-us/kb/ ... wsignin1.0

HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Post Reply