gpt4 book ai didi

c# - 确定 PDF 是否可搜索

转载 作者:行者123 更新时间:2023-11-30 23:04:56 25 4
gpt4 key购买 nike

如何以编程方式确定/验证 PDF 是否可搜索,扫描的 pdf 与否。我知道有些问题是相同的,但有些问题没有正确回答

  if (openPdfFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string strfilename = openPdfFileDialog.FileName;
pdfImageBox.Enabled = true;
btnSave.Enabled = true;
txt_Save.Enabled = true;
btnAdd.Enabled = true;
txtOcr1.Enabled = true;
this.OpenPDF(openPdfFileDialog.FileName);
ext.Text = strfilename;
txt_Save.Text = ext.Text;

}

最佳答案

如果 PDF 文档仅包含扫描图像,则其中不会包含任何文本。我们可以从 PDF 文档中提取文本并检查它是否返回空字符串,然后我们可以断定它是一个扫描的 PDF。
https://help.syncfusion.com/file-formats/pdf/working-with-text-extraction

假设您的可搜索 PDF 中没有图像,那么您可以进行图像提取。如果存在图像,则 PDF 文档包含扫描图像。
https://help.syncfusion.com/file-formats/pdf/working-with-image-extraction

注意:我为 Syncfusion 工作。

关于c# - 确定 PDF 是否可搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49042564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com