mirror of
https://github.com/astefanutti/decktape.git
synced 2024-09-11 22:27:11 +03:00
Use hummus.PDFRStreamForBuffer instead of custom buffer adapter
This commit is contained in:
parent
5513655dc3
commit
95b14dbf82
25
decktape.js
25
decktape.js
@ -2,18 +2,17 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const BufferReader = require('./libs/buffer'),
|
||||
chalk = require('chalk'),
|
||||
crypto = require('crypto'),
|
||||
Font = require('fonteditor-core').Font,
|
||||
fs = require('fs'),
|
||||
hummus = require('hummus'),
|
||||
os = require('os'),
|
||||
parser = require('./libs/nomnom'),
|
||||
path = require('path'),
|
||||
puppeteer = require('puppeteer'),
|
||||
URI = require('urijs'),
|
||||
util = require('util');
|
||||
const chalk = require('chalk'),
|
||||
crypto = require('crypto'),
|
||||
Font = require('fonteditor-core').Font,
|
||||
fs = require('fs'),
|
||||
hummus = require('hummus'),
|
||||
os = require('os'),
|
||||
parser = require('./libs/nomnom'),
|
||||
path = require('path'),
|
||||
puppeteer = require('puppeteer'),
|
||||
URI = require('urijs'),
|
||||
util = require('util');
|
||||
|
||||
const { delay, pause } = require('./libs/util');
|
||||
|
||||
@ -349,7 +348,7 @@ async function exportSlide(plugin, page, printer, context) {
|
||||
pageRanges : '1',
|
||||
displayHeaderFooter : false,
|
||||
});
|
||||
printSlide(printer, new BufferReader(buffer), context);
|
||||
printSlide(printer, new hummus.PDFRStreamForBuffer(buffer), context);
|
||||
context.exportedSlides++;
|
||||
|
||||
if (options.screenshots) {
|
||||
|
@ -1,44 +0,0 @@
|
||||
class BufferReader {
|
||||
|
||||
constructor(buffer) {
|
||||
this.rposition = 0;
|
||||
this.buffer = buffer;
|
||||
}
|
||||
|
||||
read(inAmount) {
|
||||
const arr = [];
|
||||
let amount = this.rposition + inAmount;
|
||||
if (amount > this.buffer.length) {
|
||||
amount = this.buffer.length - this.rposition;
|
||||
}
|
||||
for (let i = this.rposition; i < amount; ++i)
|
||||
arr.push(this.buffer[i]);
|
||||
this.rposition = amount;
|
||||
return arr;
|
||||
}
|
||||
|
||||
notEnded() {
|
||||
return this.rposition < this.buffer.length;
|
||||
}
|
||||
|
||||
setPosition(inPosition) {
|
||||
this.rposition = inPosition;
|
||||
}
|
||||
|
||||
setPositionFromEnd(inPosition) {
|
||||
this.rposition = this.buffer.length - inPosition;
|
||||
}
|
||||
|
||||
skip(inAmount) {
|
||||
this.rposition += inAmount;
|
||||
}
|
||||
|
||||
getCurrentPosition() {
|
||||
return this.rposition;
|
||||
}
|
||||
|
||||
close() {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BufferReader;
|
Loading…
Reference in New Issue
Block a user