mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2025-07-16 14:05:20 +02:00
32 lines
874 B
JavaScript
32 lines
874 B
JavaScript
import Transformation from './Transformation.jsx';
|
|
import PdfPage from '../PdfPage.jsx';
|
|
import ContentView from '../ContentView.jsx';
|
|
|
|
export default class RoundCoordinates extends Transformation {
|
|
|
|
constructor() {
|
|
super("Round Coordinates");
|
|
}
|
|
|
|
contentView() {
|
|
return ContentView.PDF;
|
|
}
|
|
|
|
transform(pdfPages:PdfPage[]) {
|
|
return pdfPages.map(pdfPage => {
|
|
return {
|
|
...pdfPage,
|
|
textItems: pdfPage.textItems.map(textItem => {
|
|
return {
|
|
...textItem,
|
|
x: Math.round(textItem.x),
|
|
y: Math.round(textItem.y),
|
|
width: Math.round(textItem.width),
|
|
height: Math.round(textItem.height)
|
|
}
|
|
})
|
|
};
|
|
});
|
|
}
|
|
|
|
} |