Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pdf annotation extraction location error for some pdfs #451

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions chrome/content/zotfile/pdfextract/pdfjs/src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
for (var i = 0; i < annot.quadPoints.length; i++) {
var qdims = annot.quadPoints[i].dims;
// only grab characters where 50% of the character's
// width lies within the annotation
// width lies within the annotation
if (cdims.xPlusHalfWidth >= qdims.minX && cdims.xPlusHalfWidth <= qdims.maxX &&
cdims.y >=qdims.minY && cdims.y <= qdims.maxY) {
return i;
Expand Down Expand Up @@ -1675,7 +1675,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
sw = Util.applyTransformX([spaceWidth,0], font2dev);
// TODO: why 2.0? I changed it to 3
// dims.spaceWidth = (sw[0] - font2dev[4]) / 2.0;
spaceWidthProj = (sw - font2dev[4]) / 3.0;
spaceWidthProj = (sw - font2dev[4]) / 3.0;

ctx.scale(textHScale, fontDirection);

Expand Down Expand Up @@ -1719,7 +1719,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
current.x += width * textHScale;

if (this.annotations) {
// check if glyph is within an annotation
// check if glyph is within an annotation
var chDims = this.makeCharDims(transformed * fontSize, width, spaceWidthProj, font2dev);
for (var j = 0; j < this.annotations.length; j++) {
var annot = this.annotations[j];
Expand Down Expand Up @@ -1835,7 +1835,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {

this.baseTransform = this.ctx.mozCurrentTransform;
// project coordinates of quadPoints to device space
this.makeAnnoDims(this.annotations, this.baseTransform);
// this.makeAnnoDims(this.annotations, this.baseTransform);

if (isArray(bbox) && 4 === bbox.length) {
var width = bbox[2] - bbox[0];
Expand All @@ -1850,7 +1850,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.restore();
this.baseTransform = this.baseTransformStack.pop();
// project coordinates of quadPoints to device space
this.makeAnnoDims(this.annotations, this.baseTransform);
// this.makeAnnoDims(this.annotations, this.baseTransform);
},

beginGroup: function CanvasGraphics_beginGroup(group) {
Expand Down