Giter VIP home page Giter VIP logo

react-mindee-js's People

Contributors

abdelfattahsekak avatar despprie avatar fharper avatar ooliv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-mindee-js's Issues

catch invalidPDFException in getImagesFromPDF when pdf is boken

Prerequisites

Put an X between the brackets on this line if you have done all of the following:

  • Reproduced the problem or exposed a new need
  • Checked the github existing issues

Description

React mindee js is missing a catch block getImagesFromPDF method.
When an remote PDF Url is corrupted (for example file size is 0 bytes or cannot be parsed) the pdf-dist library throw invalidPDFException.
Since it's not catched it cannot be on our side of the code

Steps to Reproduce

  1. call method getImagesFromPDF with a broken file ex: fb375f80-ccbf-4829-b61b-f1764b017221.pdf

Expected behavior:

if an error occurs the catch block should be called

      getImagesFromPDF(src)
        .then((pages: string[]) => {
        })
        .catch(() => {
          // --> HERE
        });

Actual behavior:

      getImagesFromPDF(src)
        .then((pages: string[]) => {
        })
        .catch(() => {
          // --> THE ERROR IS NEVER CATCHED
        });

Reproduces how often:

100%

Versions

"react-mindee-js": "1.3.7",

Additional Information

Patch to fix the bug and handle error in promise

diff --git a/node_modules/react-mindee-js/dist/utils/getImagesFromPDF.js b/node_modules/react-mindee-js/dist/utils/getImagesFromPDF.js
index c85c266..91ad2ac 100644
--- a/node_modules/react-mindee-js/dist/utils/getImagesFromPDF.js
+++ b/node_modules/react-mindee-js/dist/utils/getImagesFromPDF.js
@@ -50,6 +50,8 @@ export default function getImagesFromPDF(file, maxPages = Infinity, onSuccess, r
                 .catch((e) => {
                 reject({ error: e });
             });
+        }).catch((e) => {
+            reject({ error: e });
         });
     });
 }

Change master branch to main

Prerequisites

Put an X between the brackets on this line if you have done all of the following:

  • [X ] Reproduced the problem or exposed a new need
  • [ X] Checked the github existing issues

Description

Let's be allies and make this little change that means a lot.

Here is a blog post that explain a little more why it's important, and how to easily do it, even with CI/CD pipelines.

[Bug]: getImagesFromPDF helper missing PDF documents after promise resolve

Prerequisites

Put an X between the brackets on this line if you have done all of the following:

  • Reproduced the problem or exposed a new need
  • Checked the github existing issues

Description

Method getImagesFromPDF should always return an array of images with correct array order

Steps to Reproduce

  1. call getImagesFromPDF with an PDF file with at least 2 PDF documents inside
  2. When the promise resolve console.log the result of pdfPages array

Expected behavior:

getImagesFromPDF return an array of page indexed with no missing page index, and index are placed in the array at the correct index

Actual behavior:

With a PDF of 2 documents, there is only one base64 in the pdfPages array
Or the pdfPages[0] = document 2 and pdfPages[1] = page 1

Reproduces how often:

50% of the times

Versions

react-mindee-js@^1.1.1
Macos / Chrome

Additional Information

AnnotationViewer settings doesn't use global settings

Prerequisites

Put an X between the brackets on this line if you have done all of the following:

  • Reproduced the problem or exposed a new need
  • Checked the github existing issues

Description

Function drawPolyLines from drawUtils should use fillOpacity settings parameters instead of static values when renderering on canvas.

Steps to Reproduce

  1. Create a new <AnnotationViewer />
  2. Set settings props with settings={{ highlightedShapeOptions: { fillOpacity: 100 }, shapeOptions: { fillOpacity: 100 }}}
  3. Canvas predictions shapes still have an opacity of 20% and 50% on hovering shape

Expected behavior:

The shape is fully opaque

Actual behavior:

Settings are not used and opacity is static

Reproduces how often:

100% of the times

Versions

[email protected]

Additional Information

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.