2

I have a PDF created in memory using iTextSharp and contained in a MemoryStream. I now need to translate that MemoryStream PDF into something the printer understands.

I've used Report Server in the past to render the pages to the printer format but I cant use it for this project.

Is there a native .Net way of doing this? For example, GhostScript would be OK if it was a .Net assembly but I don't want to bundle any non .Net stuff along with my installer.

The PrintDocument class in .Net is great for sending content to the printer but I still need to translate it from a PDF stream into GDI at the page level.

Any good hints?

Thanks in advance

Ryan

4

2 に答える 2

2

PDF を解釈するには、GhostScript のような RIP が必要です。dll 呼び出しをラップしてプリンターに直接印刷する C# ラッパーを提供できますが、GhostScript に関連する再配布ライセンスがあります。

PDF を解釈するために、leadTools Raster Imaging Pro for .Net を使用しましたが、その印刷機能を確認する必要があります。これは高価なオプションであり、ロイヤリティ フリーではありません (これは実際には内部で GhostScript を使用しますが、LeadTools dll に非常に包まれています。このライブラリはうまく機能し、ライセンスを回避します。

Acrobat Reader に使用できる API があるかどうかわかりませんか? あなたはそれを調査することができます。

HTH

于 2009-09-08T09:15:40.500 に答える
1

別の簡単な方法は、PDFを一時ファイルに保存し、Process.Startで次のコマンドを実行することです。これにより、このAdobe ReaderPrintThrooughコマンドラインで説明されているようにPDFが直接印刷されます。

Process.Start("AcroRd32.exe /t \"C:\test.pdf\"");

アドビは他のツールに依存するのではなく、確かに正しい方法で印刷するので、これが最善の方法だと思います。それらは優れていますが、100%正確ではありません。

于 2009-09-08T09:28:35.830 に答える