mindee / react-mindee-js Goto Github PK
View Code? Open in Web Editor NEWFront-End Computer Vision SDK for React
License: MIT License
Front-End Computer Vision SDK for React
License: MIT License
Put an X between the brackets on this line if you have done all of the following:
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
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%
"react-mindee-js": "1.3.7",
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 });
});
});
}
Add copyright headers in all files. See docTR repo as an example.
Put an X between the brackets on this line if you have done all of the following:
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.
Put an X between the brackets on this line if you have done all of the following:
Method getImagesFromPDF
should always return an array of images with correct array order
getImagesFromPDF
with an PDF file with at least 2 PDF documents insideconsole.log
the result of pdfPages
arrayExpected 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
react-mindee-js@^1.1.1
Macos / Chrome
Put an X between the brackets on this line if you have done all of the following:
Function drawPolyLines
from drawUtils should use fillOpacity
settings parameters instead of static values when renderering on canvas.
<AnnotationViewer />
settings
props with settings={{ highlightedShapeOptions: { fillOpacity: 100 }, shapeOptions: { fillOpacity: 100 }}}
Expected behavior:
The shape is fully opaque
Actual behavior:
Settings are not used and opacity is static
Reproduces how often:
100% of the times
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.