1)調用PInvoke函數'PDFjet!PDFjet.NET.OptionalDeflateStream :: compress'時,堆棧不平衡。這很可能是因爲託管的PInvoke簽名與非託管目標籤名不匹配。檢查PInvoke簽名的調用約定和參數是否與目標非託管簽名相匹配。pdfJet for .net - pdf.Flush(); - 這給我一個錯誤,試圖示例
這是什麼?如果我從與PdfJet程序集相同的文件夾中刪除zlibwapi.dll,我得到: 2)無法加載DLL'zlibwapi.dll':指定的模塊找不到。 (從HRESULT異常:0x8007007E)(請注意,我沒有這個程序集添加引用,我只把它複製到Debug文件夾,並獲得ERROR1)
代碼:
`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
你甚至沒有在你所顯示的代碼中包含P/Invoke定義。任何人都無法告訴你它有什麼問題。錯誤信息非常清晰;我不確定你無法弄清楚什麼。 – 2011-05-17 10:21:44
這是與pdfjet。該衝突由Flush()拋出。這是我所知道的! – Ryan 2011-05-18 09:03:45