是否有可能使用PdfSharp从PDF文件中提取纯文本?由于其许可证,我不想使用iTextSharp.
iTextSharp 4.1.6是LGPL许可的最后一个版本,可以免费用于商业用途而无需支付许可费.
对于某些人而言,对于我来说,如何使用此版本提取文本可能会很有趣.
有没有人有想法?
如何使用 PDFSharp 从 PDF 文档中提取经过 FlateDecoded(例如 PNG)的图像?
我在 PDFSharp 示例中发现了该评论:
// TODO: You can put the code here that converts vom PDF internal image format to a
// Windows bitmap
// and use GDI+ to save it in PNG format.
// [...]
// Take a look at the file
// PdfSharp.Pdf.Advanced/PdfImage.cs to see how we create the PDF image formats.
Run Code Online (Sandbox Code Playgroud)
有人有解决这个问题的办法吗?
感谢您的回复。
编辑:因为我无法在 8 小时内回答我自己的问题,所以我这样做:
感谢您的快速回复。
我在方法“ExportAsPngImage”中添加了一些代码,但没有得到想要的结果。它只是提取了更多图像(png),它们没有正确的颜色并且扭曲了。
这是我的实际代码:
PdfSharp.Pdf.Filters.FlateDecode flate = new PdfSharp.Pdf.Filters.FlateDecode();
byte[] decodedBytes = flate.Decode(bytes);
System.Drawing.Imaging.PixelFormat pixelFormat; …
Run Code Online (Sandbox Code Playgroud)