Microsoft Server

时间:2016-07-21 09:21:43

标签: windows pdf pdf-generation driver windows-server-2012

我开发了一个C#,Web表单应用程序,它生成一个PDF文档服务器端并将其发送到客户端。我使用 Microsoft Print To PDF (MPTP) PrintDocument PrintPageEventArgs.Graphics.DrawString 生成PDF。这在我的本地机器上运行良好。

输入服务器:当我上传我的应用程序并尝试在我的服务器上运行它时,我收到一条错误消息,指出没有安装打印机。我检查打印机和设备,看,MPTP没有在服务器上列出(我的问题的一个修复是将MPTP设置为默认打印机)。

如果“打印机和设备”中没有MPTP:

  • 打开“打开或关闭Windows功能”,然后检查MPTP。

问题是我也没有MPTP。解决这个问题:

  • 打开设备和打印机
  • 添加打印机
  • “我想要的打印机未列出”
  • “使用手动设置添加本地打印机或网络打印机”
  • 选择端口“文件:(打印到文件)”(我试过其他端口,它是一样的)
  • 在左侧(制造商)部分选择Microsoft,右侧选择MPTP

它应该安装MPTP的驱动程序,但问题是我没有列表上的MPTP !这是有问题的部分。

我无法在线找到这个问题的帮助(找不到甚至未解答的问题)。我无法在线找到驱动程序,因此我可以手动安装它们,但不知道如何解决它。

我尝试使用CutePDF Writer和Spire.PDF生成PDF(我确实生成了PDF,但是本地字符不起作用[č,š,ž],我必须使用PdfDocument,PdfSection,PdfTextWidget)。我不喜欢用Spire.PDF生成,因为我必须为多页文档实现正确的标题和签名(这是一个痛苦的屁股,我更喜欢使用已经编写和测试的代码,使用PrintDocument和MPTP)。

为什么我的服务器缺少Microsoft Print to PDF驱动程序?

服务器信息 :Microsoft Windows Server版本6.2(Build 9200)。 Internet信息服务版本8.5.9600.16384。

3 个答案:

答案 0 :(得分:2)

@AlexK was right。我是新手使用服务器,并且错误地认为它在实际使用Server 2012 R2时运行了Windows 10。

问题是我在谷歌搜索&#34; Windows 10打印到pdf&#34;。当我尝试搜索Server 2012时,我发现 打印到PDF 在Server 2012上不存在,这就是我无法找到它的原因。< / p>

答案 1 :(得分:0)

解决方法是首先使用Windows XPS打印机打印到XPS,然后使用GhostScript的GhostXPS实用程序将后续过程转换为PDF文件。

在我的C#应用​​程序中,我使用System.Diagnostics.Process来设置参数并启动gxpswin64.exe命令行可执行文件。

这是一个例子: Convert XPS to PDF without Printer Driver

参考文献:

GhostScript.com

GhostXPS.html

答案 2 :(得分:0)

This isn't really a solution, but do I have a workaround for printing a document on Windows Server 2012 R2 if you have a Windows 10 PC you can use. Here are the steps:

  1. On the Windows Server 2012 R2 Machine, go to the Start Menu.
  2. Find "Turn Windows Features On or Off" (Probably requires Admin privileges)
  3. The Server Manager will launch
  4. Installation Type > Role-based or feature-based installation
  5. Select local server
  6. Server Roles > Turn on Print and Document Services > Print Server
  7. Features > XPS Viewer
  8. Install

This will allow you to print to Microsoft XPS Document Writer which will create a ".oxps" file that you can save to the server. Copy that file to your Windows 10 computer and you can then:

  1. Open the .oxps file on the Windows 10 PC using the XPS viewer that is installed by default.
  2. Print > Select Printer > Microsoft Print to PDF
  3. Print
相关问题