Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit ddba776b authored by Volker Krause's avatar Volker Krause

Preserve unrecognized barcodes

parent 8a5f77f6
......@@ -56,6 +56,8 @@ void GenericPdfExtractor::setContextDate(const QDateTime &dt)
void GenericPdfExtractor::extract(PdfDocument *doc, QJsonArray &result)
// stay away from documents that are atypically large for what we are looking for
// that's just unecessarily eating up resources
if (doc->pageCount() > MaxPageCount || doc->fileSize() > MaxFileSize) {
......@@ -95,6 +97,11 @@ void GenericPdfExtractor::extract(PdfDocument *doc, QJsonArray &result)
QStringList GenericPdfExtractor::unrecognizedBarcodes() const
return m_unrecognizedBarcodes;
void GenericPdfExtractor::extractImage(const PdfImage &img, QJsonArray &result)
const auto aspectRatio = img.width() < img.height() ?
......@@ -125,6 +132,8 @@ void GenericPdfExtractor::extractBarcode(const QString &code, QJsonArray &result
const auto jsonLd = JsonLdDocument::toJson(res);
std::copy(jsonLd.begin(), jsonLd.end(), std::back_inserter(result));
void GenericPdfExtractor::extractUic9183(const QByteArray &data, QJsonArray &result)
......@@ -21,6 +21,7 @@
#include <unordered_set>
#include <QDateTime>
#include <QStringList>
class QJsonArray;
class QString;
......@@ -49,12 +50,16 @@ public:
/** Try to extract the given document. */
void extract(PdfDocument *doc, QJsonArray &result);
/** Barcodes that we couldn't recognize, for use with custom extractors. */
QStringList unrecognizedBarcodes() const;
void extractImage(const PdfImage &img, QJsonArray &result);
void extractBarcode(const QString &code, QJsonArray &result);
void extractUic9183(const QByteArray &data, QJsonArray &result);
QDateTime m_contextDate;
QStringList m_unrecognizedBarcodes;
std::unordered_set<int> m_imageIds;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment