react-pdf-highlighter
react-pdf-highlighter copied to clipboard
Small fix for pdfToViewport function
top should be y2 not y1
@davidkong0987 after attempting to do what you suggested here, the result is still very odd. Seems like this function performs some transformation but the rectangle is flipped upside down.
const pdfToViewport = (pdf: Scaled, viewport: Viewport): LTWHP => {
const [x1, y1, x2, y2] = viewport.convertToViewportRectangle([
pdf.x1,
pdf.y1,
pdf.x2,
pdf.y2,
]);
return {
left: x1,
top: y2,
width: x2 - x1,
height: y1 - y2,
pageNumber: pdf.pageNumber,
};
};
Fixed in #244.