pdfJet for .net - pdf.同花顺();- 这给了我一个错误 wh 尝试这个例子
本文关键字:错误 一个 wh pdf net for 同花顺 pdfJet | 更新日期: 2023-09-27 17:56:56
1) 对 PInvoke 函数 'PDFjet!PDFjet.NET.OptionalDeflateStream::compress' 使堆栈不平衡。这可能是因为托管 PInvoke 签名与非托管目标签名不匹配。检查 PInvoke 签名的调用约定和参数是否与目标非托管签名匹配。
这是怎麽?如果我从与 PdfJet 程序集相同的文件夹中删除 zlibwapi.dll,我会得到:2)无法加载DLL 'zlibwapi.dll':找不到指定的模块。(HRESULT的例外:0x8007007E)(请注意,我没有添加对此程序集的引用,我只将其复制到调试文件夹,并得到错误 1)
法典:
`static void Main(string[] args)
{
FileStream fos = new FileStream("Example_05.pdf", FileMode.Create);
BufferedStream bos = new BufferedStream(fos);
PDF pdf = new PDF(bos);
pdf.setCompressor(Compressor.ORIGINAL_ZLIB);
// Before you enable this flag please read README.ZLIB.TXT
// in the 'optional' directory.
// If PDF/A is not required use Helvetica, TimesRoman or Courier
Font f1 = new Font(pdf, "Helvetica");
/*
Font f1 = new Font(pdf,
new FileStream(
"fonts/DroidFonts/DroidSans.otf", FileMode.Open),
CodePage.UNICODE,
Embed.YES);
*/
Page page = new Page(pdf, Letter.PORTRAIT);
TextLine text = new TextLine(f1);
text.SetPosition(300.0, 300.0);
for (int i = 0; i < 360; i += 15)
{
text.SetTextDirection(i);
text.SetUnderline(true);
// text.SetStrikeLine(true);
text.SetText(" Hello, World -- " + i + " degrees.");
text.DrawOn(page);
}
text = new TextLine(f1, "WAVE AWAY");
text.SetPosition(70.0, 50.0);
text.DrawOn(page);
f1.SetKernPairs(true);
text.SetPosition(70.0, 70.0);
text.DrawOn(page);
f1.SetKernPairs(false);
text.SetPosition(70.0, 90.0);
text.DrawOn(page);
f1.SetSize(8);
text = new TextLine(f1, "-- font.SetKernPairs(false);");
text.SetPosition(150.0, 50.0);
text.DrawOn(page);
text.SetPosition(150.0, 90.0);
text.DrawOn(page);
text = new TextLine(f1, "-- font.SetKernPairs(true);");
text.SetPosition(150.0, 70.0);
text.DrawOn(page);
Point point = new Point(300.0, 300.0);
point.SetShape(Point.CIRCLE);
point.SetFillShape(true);
point.SetColor(RGB.BLUE);
point.SetRadius(37.0);
point.DrawOn(page);
point.SetRadius(25.0);
point.SetColor(RGB.WHITE);
point.DrawOn(page);
pdf.Flush();
bos.Close();
}`
注意:代码是pdfJet网站上提供的确切示例:pdfjet
从您的(示例)代码中:
// Before you enable this flag please read README.ZLIB.TXT
// in the 'optional' directory.
来自自述文件。ZLIB.TXT...:
PDFjet的.NET版本正在使用 由 框架。然而,DeflateStream 确实如此 不压缩数据以及 原始的 zlib 库。
如果您在 32 位上运行 PDFjet Windows版本并希望它 创建较小的 PDF 文件 - 复制 zlibwapi.dll到同一目录 PDFjet.dll安装的地方。
当 zlibwapi.dll 不使用 PDFjet 时 是 100% 纯托管代码。什么时候 zlibwapi.dll被使用 - 你会变得更好 压缩和较小的 PDF 文件。
强调我的。所以你在 32 位上,我猜?而且您绝对需要非托管压缩,而不能只是返回到托管压缩?
pdf.setCompressor(Compressor.ORIGINAL_ZLIB);它可以工作