Coder Social home page Coder Social logo

Comments (4)

dothinking avatar dothinking commented on August 10, 2024

多谢指出问题和提供案例。测试了一下,很遗憾,pdf2docx无法较好地转换你的文档。

程序报 ValueError: no valid image found错误

已经发布的0.4.6版本确实对图片的支持存在不足,例如仅支持常规的RGB颜色空间,而你第二页的图片是ICCBased。所以在dev分支做了一些改进尝试,目前还在进行中。

from pdf2docx.

dothinking avatar dothinking commented on August 10, 2024

最主要的还是部分中文乱码问题

pdf2docx本身是支持中文的,但是你提供的PDF文件不知是文件损坏还是版权保护有意为之,一些中文字符读出之后显示乱码。查找资料的解释是PDF文件缺少cmaps表——将CJK(中日韩)字符映射到unicode字符的规则,结果导致无法正确获取文本。

例如手动复制第7页前言第一句话“欢迎阅读本书的第2版”,粘贴后就成了:

൓ᤀ᫝ឳ本书ᄉኃ2版

如果尝试在线的PDF转word网站,例如smallpdf,结果也是一样的。


你的测试文件让我理解了 @shumintao 提的一个问题 #62

from pdf2docx.

leyiwang avatar leyiwang commented on August 10, 2024

确实对图片的支持存在不足,例如仅支持常规的RGB颜色空间,而你第二页的图片是ICCBased。所以在dev分支做了一些改进尝试,目前还在进行中。

了解了,加油!

from pdf2docx.

leyiwang avatar leyiwang commented on August 10, 2024

最主要的还是部分中文乱码问题

pdf2docx本身是支持中文的,但是你提供的PDF文件不知是文件损坏还是版权保护有意为之,一些中文字符读出之后显示乱码。查找资料的解释是PDF文件缺少cmaps表——将CJK(中日韩)字符映射到unicode字符的规则,结果导致无法正确获取文本。

例如手动复制第7页前言第一句话“欢迎阅读本书的第2版”,粘贴后就成了:

൓ᤀ᫝ឳ本书ᄉኃ2版

如果尝试在线的PDF转word网站,例如smallpdf,结果也是一样的。

你的测试文件让我理解了 @shumintao 提的一个问题 #62

确实,也尝试用了其他的工具和pymupdf的作者也进行了交流,目前确实还无法解析示例中复制乱码的pdf文档

from pdf2docx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.