Pdf2docx: Skip items that cause errors

Created on 21 Oct 2020  ·  5Comments  ·  Source: dothinking/pdf2docx

Let's assume that for now there is no way to process the floating images, as an _enhancement_ I would like to make a small recommendation for _future updates_. It would be very useful a parameter that allows omitting the images or objects that cause errors, and so that the incoming pdf file, although it has unprocessable elements, can be omitted and get the output file without these elements, and then one as a programmer is responsible for making these clarifications to the user.

enhancement

All 5 comments

This makes sense. How about set "omitting the images or objects that cause errors" as a default behavior, and show log information when this happened? Thanks for your suggestion.

How about set "omitting the images or objects that cause errors" as a default behavior, and show log information when this happened?

Also, I think it's great, thanks for taking it into consideration. I'll be using this library a lot so you'll see me around a lot, it's the best and easiest to use and I feel it has a lot of potential for more features.

I think that the following information of the omitted items can be shown in the _log information_:
Page, type (table, image...), and that somehow the respective blank space is left where the element was, this way even if elements have been omitted there will be no change in the order or number of pages.

I'll be using this library a lot so you'll see me around a lot, it's the best and easiest to use and I feel it has a lot of potential for more features.

This library is rule-based to map pdf objects to docx, e.g. some texts surrounded by horizontal/vertical lines -> a table in docx. The limited rules never accommodate all cases, so definitely a lot of potential features/enhancements. Welcome and thanks for make it grow up, so that it can benefit for more people.

Page, type (table, image...), and that somehow the respective blank space is left where the element was

Good point. Just one comment: as a layout format for printing, what we extract from pdf is either text or image or shape (like a line, a rectangle) and their coordinates in the page. So, of course, the blank space is preserved, but regarding the type, I'm afraid it can provide image only since no 'table' exists for pdf.

Welcome and thanks for make it grow up, so that it can benefit for more people.

Thanks, I will be testing with different files with different contents to see how the library reacts to each one and if there is any failure I will be leaving it here (in issues) with the detailed information..

I'm afraid it can provide image only since no 'table' exists for pdf.

When I said "table" I meant things like this:
2020-10-22 12_29_14
Although I just sensed that that counts as simple lines, sorry, bad way to refer to that. In the same way the idea is that, to say the type of element that has been omitted, I do not know the truth what type of element to mention apart from an image, but the idea is already clear hehe.

Didn't get time to this project for so long a time. A new version was released finally at this moment, the first day of New Year. :) It gets improved on image extraction, e.g. floating image, and paragraph format. Hope to make progress on this issue.

pip install --upgrade pdf2docx
Was this page helpful?
0 / 5 - 0 ratings

Related issues

echan00 picture echan00  ·  9Comments

startxc picture startxc  ·  4Comments

harrylyf picture harrylyf  ·  5Comments

JoHnTsIm picture JoHnTsIm  ·  7Comments

RaymiiOrg picture RaymiiOrg  ·  3Comments