The problem is whenever we try to create PDF from windows service or IIS the PDF is saved to the windows "system32" folder with name "untitled.pdf".
Attached you can find a demo windows service project (C#), basically derived from the example provided when installing PDF-Xchange.
We have all the properties set for the PDF-Xchange, but the windows service / IIS always saves the file in System32 folder.
We have tried all the options, like for windows service, Longin via network account, admin account, full rights to the path where file has to be saved, added IIS Users permissions to the folder but the result is same.
Using COM Library from the PDF-Xchange, using nuget package both have the same result.
Changing the properties for pdfsaver.exe, full permission for IIS Users, service users also doesn't help.
Any help is appreciated.
PDF Creation from Windows Service and IIS SOLVED
Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Stefan - PDF-XChange
-
- User
- Posts: 2
- Joined: Mon May 19, 2025 9:08 am
PDF Creation from Windows Service and IIS
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 10998
- Joined: Wed Jan 03, 2018 6:52 pm
Re: PDF Creation from Windows Service and IIS
Hello, shahchandra
I have escalated this item to our Dev team for review. If they do not reach out directly, I will return here once I have heard back from them on the matter.
Kind regards,
I have escalated this item to our Dev team for review. If they do not reach out directly, I will return here once I have heard back from them on the matter.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: PDF Creation from Windows Service and IIS SOLVED
The problem is in the driver, but there is a simple workaround.
The problem is that the driver expects the destination file name to be specified in two components: "Save.Path" and "Save.File". If the "Save.Path" is empty (default value), the user's "My Documents" folder is used. Then, this folder name is combined with the filename itself. If the "Save.File" contains the absolute path, it is used instead of the path specified in "Save.Path". And there is a mistake in the driver's logic - it fails when the folder name is empty. And that happens under service, as there are no "My Documents". We will fix this issue in the next build.
Now, about the workaround - it is enough to specify any folder in the "Save.Path" parameter, for example, add this line:
HTH
The problem is that the driver expects the destination file name to be specified in two components: "Save.Path" and "Save.File". If the "Save.Path" is empty (default value), the user's "My Documents" folder is used. Then, this folder name is combined with the filename itself. If the "Save.File" contains the absolute path, it is used instead of the path specified in "Save.Path". And there is a mistake in the driver's logic - it fails when the folder name is empty. And that happens under service, as there are no "My Documents". We will fix this issue in the next build.
Now, about the workaround - it is enough to specify any folder in the "Save.Path" parameter, for example, add this line:
Code: Select all
PDFPrinter.set_Option("Save.Path", @"c:\");
PDF-XChange Co Ltd. (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.
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.
-
- User
- Posts: 2
- Joined: Mon May 19, 2025 9:08 am
Re: PDF Creation from Windows Service and IIS
Hi,
Thanks for the quick response.
The given workaround works with both windows service and IIS.
Thanks for the quick response.
The given workaround works with both windows service and IIS.
-
- Site Admin
- Posts: 617
- Joined: Tue Mar 03, 2015 12:46 pm