Skip to content

Commit

Permalink
Merge pull request #293 from axa-group/feature/Image_Module_Off
Browse files Browse the repository at this point in the history
Skip Images if Image Detection Module is Off
  • Loading branch information
marianorodriguez authored Jan 13, 2020
2 parents 043301e + 59690f5 commit 26a9936
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/src/output/json/JsonExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ export class JsonExporter extends Exporter {
jsonElement.codeType = element.type;
jsonElement.codeValue = element.content;
} else if (element instanceof Image) {
if (!element.enabled) {
// If image detection module is not executed in pipe all images have enabled = false
return null;
}
jsonElement.src = element.src; // TODO replace this with a location based on an API access point
jsonElement.refId = element.refId;
jsonElement.xObjId = element.xObjId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class ImageDetectionModule extends Module {
}
const images = doc.getElementsOfType(Image, true);
if (images.length > 0) {
images.forEach(img => (img.enabled = true));
const assets: string[] = fs.readdirSync(doc.assetsFolder);
const dumpPdf = await this.getFileMetadata(doc.inputFile);
this.linkXObjectToImages(images, dumpPdf);
Expand Down
1 change: 1 addition & 0 deletions server/src/types/DocumentRepresentation/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class Image extends Element {
}

public content: null = null;
public enabled: boolean = false;
private _src: string;
private _refId: string;
private _xObjId: string;
Expand Down

0 comments on commit 26a9936

Please sign in to comment.