import React from 'react';
import Badge from 'react-bootstrap/lib/Badge'
import ButtonToolbar from 'react-bootstrap/lib/ButtonToolbar'
import ButtonGroup from 'react-bootstrap/lib/ButtonGroup'
import Button from 'react-bootstrap/lib/Button'
import DropdownButton from 'react-bootstrap/lib/DropdownButton'
import MenuItem from 'react-bootstrap/lib/MenuItem'
import PdfPageView from './PdfPageView.jsx';
// A view which displays the TextItems of multiple PdfPages
export default class PdfView extends React.Component {
static propTypes = {
pdfPages: React.PropTypes.array.isRequired,
transformations: React.PropTypes.array.isRequired,
};
constructor(props) {
super(props);
this.state = {
currentTransformation: 0,
pageNr: -1
};
}
selectPage(pageNr) {
this.setState({
pageNr: pageNr
});
}
selectTransformation(currentTransformation) {
this.setState({
currentTransformation: currentTransformation
});
}
nextTransformation() {
this.setState({
currentTransformation: this.state.currentTransformation + 1
});
}
prevTransformation() {
this.setState({
currentTransformation: this.state.currentTransformation - 1
});
}
render() {
const {currentTransformation, pageNr} = this.state;
const {pdfPages, transformations} = this.props;
const header = "Parsed " + pdfPages.length + " pages!"
const currentTransformationName = transformations[currentTransformation].name;
const transformedPdfPages = pdfPages.filter((elem, i) => pageNr == -1 || i == pageNr).map(pdfPage => {
for (var i = 0; i <= currentTransformation; i++) {
pdfPage = transformations[i].transform(pdfPage);
}
return pdfPage;
});
var pageComponents = transformedPdfPages.map(page =>
|
|
{ ' ' } |