mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Fix AppendText after API changes
This commit is contained in:
parent
a33ba145bf
commit
e48530d391
2 changed files with 7 additions and 7 deletions
|
@ -168,23 +168,23 @@ SimpleTextLayerBuilder.prototype = {
|
|||
endLayout: function SimpleTextLayerBuilder_EndLayout() {
|
||||
this.ctx.restore();
|
||||
},
|
||||
appendText: function SimpleTextLayerBuilder_AppendText(text, fontName,
|
||||
fontSize) {
|
||||
appendText: function SimpleTextLayerBuilder_AppendText(fontName, fontSize,
|
||||
geom) {
|
||||
var ctx = this.ctx, viewport = this.viewport;
|
||||
// vScale and hScale already contain the scaling to pixel units
|
||||
var fontHeight = fontSize * text.geom.vScale;
|
||||
var fontHeight = fontSize * geom.vScale;
|
||||
ctx.beginPath();
|
||||
ctx.strokeStyle = 'red';
|
||||
ctx.fillStyle = 'yellow';
|
||||
ctx.rect(text.geom.x, text.geom.y - fontHeight,
|
||||
text.canvasWidth * text.geom.hScale, fontHeight);
|
||||
ctx.rect(geom.x, geom.y - fontHeight,
|
||||
geom.canvasWidth * geom.hScale, fontHeight);
|
||||
ctx.stroke();
|
||||
ctx.fill();
|
||||
|
||||
var textContent = this.textContent.text[this.textCounter];
|
||||
ctx.font = fontHeight + 'px ' + fontName;
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.fillText(textContent, text.geom.x, text.geom.y);
|
||||
ctx.fillText(textContent, geom.x, geom.y);
|
||||
|
||||
this.textCounter++;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue