简体   繁体   English

未在 Windows 服务应用程序 C# 中使用 CutePDF writer 生成 PDF 文档

[英]Not generating a PDF documents using CutePDF writer in windows service application C#

I converted text files to PDF documents using CutePDF Writer printer in windows forms application.It's working as expected but same block of code I used in c# windows service application to convert text files to PDF files.I'm not getting any exceptions while executing the code and not generating any PDF documents.我使用 Windows 窗体应用程序中的CutePDF Writer 打印机将文本文件转换为 PDF 文档。它按预期工作,但与我在 c# windows 服务应用程序中用于将文本文件转换为 PDF 文件的代码块相同。执行代码而不生成任何 PDF 文档。

I created the following registry key settings for CutePDF writer我为CutePDF writer 创建了以下注册表项设置

Setting the display mode:设置显示模式:

HKEY_CURRENT_USER\\Software\\CutePDF Writer\\BypassSaveAs (0 = show Save as dialog box after spooling, 1 = do not show Save as dialog box.) (This value is of type REG_SZ, not REG_DWORD) HKEY_CURRENT_USER\\Software\\CutePDF Writer\\BypassSaveAs(0 = 假脱机后显示另存为对话框,1 = 不显示另存为对话框。)(此值的类型为 REG_SZ,而不是 REG_DWORD)

Setting the filename:设置文件名:

HKEY_CURRENT_USER\\Software\\CutePDF Writer\\OutputFile (Use the key above to set the output file for the PDF. A full pathname (eg d:\\your folder\\your file.pdf) is required.) HKEY_CURRENT_USER\\Software\\CutePDF Writer\\OutputFile(使用上面的键设置PDF的输出文件。需要一个完整的路径名(例如d:\\your folder\\your file.pdf)。)

Not familiar with CutePDF Writer - but: as which user is the service running?不熟悉CutePDF Writer - 但是:服务以哪个用户运行?

To clarify this: if the service runs as LocalService, the registry key HKEY_CURRENT_USER is not the same as the one from loged in user.为了澄清这一点:如果服务作为 LocalService 运行,则注册表项 HKEY_CURRENT_USER 与来自登录用户的注册表项不同。

If that is the case, try HKEY_USERS\\S-1-5-19 instead of HKEY_CURRENT_USER.如果是这种情况,请尝试 HKEY_USERS\\S-1-5-19 而不是 HKEY_CURRENT_USER。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM