Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将输出另存为PDF文件_C#_Asp.net_.net_Officewriter - Fatal编程技术网

C# 将输出另存为PDF文件

C# 将输出另存为PDF文件,c#,asp.net,.net,officewriter,C#,Asp.net,.net,Officewriter,我们目前正在使用SoftArtisan生成Excel和Word文件。 我们需要扩展它来创建PDF文件 OfficeWriter目前是否支持此功能 如果没有,是否有计划添加此功能?或者任何可用于将Excel/Word文件转换为PDF格式的开源库?据我所知,这些库是最好、最流行的。Migradoc是PdfSharp的高级封面。PfgSharp非常受欢迎。下面是一个来自CodeProject的示例,介绍如何创建一个简单的PDF,以了解如何使用它: class Program { stati

我们目前正在使用SoftArtisan生成ExcelWord文件。 我们需要扩展它来创建PDF文件

OfficeWriter目前是否支持此功能


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

据我所知,这些库是最好、最流行的。Migradoc是PdfSharp的高级封面。

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);
    }
  } 

注:我为软工匠工作,他们是OfficeWriter的制作者

OfficeWriter当前不支持将Excel/Word文件转换为PDF。我们通常建议使用第三方组件转换为PDF。但是,这些组件中有许多需要在服务器上安装Office,Microsoft不建议这样做。因此,选择一个不需要在服务器上安装Office的转换器,或者仔细管理它,这一点很重要

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

•Word Services for Sharepoint–如果您使用的是Sharepoint Server 2010,则可以使用Word Services执行格式转换。有关此解决方案的更多信息,请访问:

•彩虹PDF-彩虹PDF.com

•EasyPDF-pdfonline.com/EasyPDF/


有关更多信息,请参阅我们的博文:

这只是
helloworld
code。我尝试了这两种方法,我真的怀疑是否有人直接使用PdfSharp。这只是一个hello world的例子。我们正在考虑创建包含图像、表格、格式、页脚等的专业PDF文档。我们的大多数客户都询问了Word到PDF的转换,因此我们准备了相应的建议。我们目前正在寻找一些Excel到PDF的推荐请注意,我也为SoftArtisan工作。不幸的是,这些工具不是作为Excel Writer许可证的附加组件提供的,我们也必须在它们上花费$$。您找到免费的替代方案了吗?为什么不将此功能添加到您自己的库中,如Aspose.Cells?PdfSharp/Migradoc是否将现有Excel文件转换为PDF?您是否找到了解决方案?