mirror of
https://github.com/astefanutti/decktape.git
synced 2024-08-17 10:10:30 +03:00
Do not remove identical image references
This commit is contained in:
parent
3758c4e9f5
commit
df96abbe10
@ -458,9 +458,12 @@ async function printSlide(pdf, slide, context) {
|
|||||||
const subtype = object.dict.get(PDFName.of('Subtype'));
|
const subtype = object.dict.get(PDFName.of('Subtype'));
|
||||||
if (subtype === PDFName.of('Image')) {
|
if (subtype === PDFName.of('Image')) {
|
||||||
const digest = crypto.createHash('SHA1').update(object.contents).digest('hex');
|
const digest = crypto.createHash('SHA1').update(object.contents).digest('hex');
|
||||||
if (!context.pdfXObjects[digest]) {
|
const existing = context.pdfXObjects[digest];
|
||||||
|
if (!existing) {
|
||||||
|
// Store the entry that'll replace references with the same content
|
||||||
context.pdfXObjects[digest] = entry;
|
context.pdfXObjects[digest] = entry;
|
||||||
} else {
|
} else if (entry !== existing) {
|
||||||
|
// Only remove references from different pages
|
||||||
xObject.set(name, context.pdfXObjects[digest]);
|
xObject.set(name, context.pdfXObjects[digest]);
|
||||||
duplicatedEntries.push(entry);
|
duplicatedEntries.push(entry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user