我目前正在尝试找到一个无需运行 X 服务器即可运行的 PDF 库。我已经尝试过以下...
- Migradoc/PDFSharp(需要 X)
- ITextSharp(需要 X)
- SharpPDF(可能有用,但我正在寻找具有更多功能的东西)
该库不必是开源的或免费的。
我的解决方案在 Apache2.2 mod_mono 上运行。
有人知道这样的图书馆吗?
- - 编辑 - -
下面列出了用于 itextsharp 的测试代码,它会在我的测试服务器上产生错误(Migradoc 和 SharpPDF 的代码同样简单):
using System;
using sharp=iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.xml;
using System.IO;
namespace pdftester
{
public static class ITextSharpTest
{
public static void HelloWorld(string filename)
{
Stream stream = new FileStream(filename, FileMode.Create);
sharp.Document document = new sharp.Document();
PdfWriter.GetInstance(document, stream);
document.Open();
document.Add(new sharp.Paragraph("Hello world"));
document.Close();
}
}
}