小编der*_*urg的帖子

C#使用PdfSharp从PDF中提取文本

是否有可能使用PdfSharp从PDF文件中提取纯文本?由于其许可证,我不想使用iTextSharp.

c# text text-extraction pdfsharp

35
推荐指数
3
解决办法
3万
查看次数

如何使用iTextSharp 4.1.6提取文本?

iTextSharp 4.1.6是LGPL许可的最后一个版本,可以免费用于商业用途而无需支付许可费.

对于某些人而言,对于我来说,如何使用此版本提取文本可能会很有趣.

有没有人有想法?

c# text-extraction itextsharp

9
推荐指数
1
解决办法
6270
查看次数

如何使用 PDFSharp 从 PDF 中提取 FlateDecoded 图像

如何使用 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)

c# pdfsharp

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

c# ×3

pdfsharp ×2

text-extraction ×2

itextsharp ×1

text ×1