将输出保存为PDF文件

时间:2013-10-04 07:19:56

标签: c# asp.net .net officewriter

我们目前正在使用SoftArtisans生成 Excel Word 文件。 我们需要扩展它以创建 PDF 文件。

OfficeWriter目前是否支持此功能?

如果没有,是否有计划添加此功能?或者任何可用于将Excel / Word文件转换为PDF格式的开源库?

3 个答案:

答案 0 :(得分:1)

据我所知,{p> PdfSharp and Migradoc是最好的和最受欢迎的。 Migradoc是PdfSharp的高级别封面。

答案 1 :(得分:0)

注意:我为OfficeWriter的制造商SoftArtisans工作。

OfficeWriter目前不支持将Excel / Word文件转换为PDF。我们通常建议将第三方组件转换为PDF。但是,许多这些组件需要在服务器上安装Office,而Microsoft不建议这样做。因此,请务必选择不需要在服务器上安装Office或对其进行管理的转换器

以下是我们过去向用户推荐的将Word转换为PDF的几种解决方案:

•Sharepoint的Word Services - 如果您使用的是SharePoint Server 2010,则可以使用Word Services执行格式转换。有关此解决方案的更多信息,请访问:http://msdn.microsoft.com/en-us/library/office/ff181518.aspx

•彩虹PDF - rainbowpdf.com

•EasyPDF - pdfonline.com/easypdf /

有关详细信息,请参阅我们的博文:http://blog.softartisans.com/2011/08/05/kb-tools-to-convert-word-documents-to-pdf/

答案 2 :(得分:-1)

PfgSharp非常受欢迎。以下是CodeProject关于如何创建简单PDF以了解如何使用它的示例:

class Program
  {
    static void Main(string[] args)
    {
   // Create a new PDF document
      PdfDocument document = new PdfDocument();
      document.Info.Title = "Created with PDFsharp";

      // Create an empty page
      PdfPage page = document.AddPage();

      // Get an XGraphics object for drawing
      XGraphics gfx = XGraphics.FromPdfPage(page);

      // Create a font
      XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);

      // Draw the text
      gfx.DrawString("Hello, World!", font, XBrushes.Black,
        new XRect(0, 0, page.Width, page.Height),
        XStringFormats.Center);

      // Save the document...
      const string filename = "HelloWorld.pdf";
      document.Save(filename);
      // ...and start a viewer.
      Process.Start(filename);
    }
  } 
相关问题