static void ConvertFromStream()
{
// The conversion process will be done completely in memory.
string inpFile = @"..\..\..\example.xml";
string outFile = @"ResultStream.pdf";
byte[] inpData = File.ReadAllBytes(inpFile);
byte[] outData = null;
using (MemoryStream msInp = new MemoryStream(inpData))
{
// Load a document.
DocumentCore dc = DocumentCore.Load(msInp, new XMLLoadOptions());
// Save the document to PDF format.
using (MemoryStream outMs = new MemoryStream())
{
dc.Save(outMs, new PdfSaveOptions() );
outData = outMs.ToArray();
}
// Show the result for demonstration purposes.
if (outData != null)
{
File.WriteAllBytes(outFile, outData);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
}
3条答案
按热度按时间kxe2p93d1#
尝试Aspose。
http://www.aspose.com/categories/.net-components/aspose.cells-for-.net/default.aspx
您可能还需要PDF组件,不确定他们现在是如何做到的。
mutmk8jj2#
你能简单地使用一些pdf打印机来做吗?
deyfvvtc3#
尝试使用免费解决方案(EpPlus):https://github.com/EPPlusSoftware/EPPlus或电子表格https://spreadsheetlight.com/另一种方法: