将 DDE 消息传递到 Acrobat Reader 时路径中的特殊字符出现问题
我已经研究一个问题有一段时间了,但没有找到解决方案。也尝试过谷歌,但没有走上正轨...
任何帮助将不胜感激!
问题是:
我正在发送 DDE 命令,打开 PDF 文档以静默打印它。如果路径包含非 ASCII 字符,则问题出在路径上。它不会被识别并且会抛出错误。我应该如何处理路径字符串才能避免这种情况并让 Acrobat reader 理解路径?我尝试过用“o”代替“ø”,效果完美......提前致谢!
string file = @"C:\Users\Bø\1_tmp_printpages.pdf";
client.Execute("[DocOpen(\"" + file + "\")]", 60000);
client.Execute("[FilePrintSilent(\"" + file + "\")]", 60000);
client.Execute("[DocClose(\"" + file + "\")]", 60000);
client.Execute("[AppExit]", 60000);
我正在使用 NDde 传递 DDE 消息。
I've been looking into a problem for some time without finding a solution to it. Tried google as well, without getting on track...
Any help would be appreciated!
Problem is:
I'm sending a DDE-command, to open a PDF document to print it silently. Problem is with the path, if it has non-ASCII chars. It would not get recognized and it throws an error. What should I do with the path string to avoid this and to get Acrobat reader to understand the path? I've tried with an "o" instead of "ø", and that works flawlessly... Thanks in advance!
string file = @"C:\Users\Bø\1_tmp_printpages.pdf";
client.Execute("[DocOpen(\"" + file + "\")]", 60000);
client.Execute("[FilePrintSilent(\"" + file + "\")]", 60000);
client.Execute("[DocClose(\"" + file + "\")]", 60000);
client.Execute("[AppExit]", 60000);
I'm using NDde to pass DDE messages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我无法找到除 C# NDde 之外的 DDE 库,因此我无法处理路径中的非 US-ASCII 符号。因此我决定使用不同的方法,动词。
这是我的新代码,它接受非 US-ASCII 符号。它位于 try 块内,之后我正在执行一些逻辑来终止 AcroRd32。但静默打印 PDF 的代码本身就在下面......:)
Since I couldnt find a DDE library other than NDde for C#, I was not able to process non US-ASCII symbols in my path. Therefore I decided to use a different approach, verbs.
Here is my new code that accepts non US-ASCII symbols. It's inside a try-block, and I'm doing some logic to kill AcroRd32 afterwards. But the code itself to print PDF silently is underneath... :)