pdf-to-markdown/src/javascript/models/transformations/ToMarkdown.jsx

28 lines
583 B
React
Raw Normal View History

2017-01-22 19:04:23 +01:00
import Transformation from './Transformation.jsx';
import TextPage from '../TextPage.jsx';
import ContentView from '../ContentView.jsx';
2017-02-06 19:13:43 +01:00
export default class ToMarkdown extends Transformation {
2017-01-22 19:04:23 +01:00
constructor() {
2017-02-06 19:13:43 +01:00
super("To Markdown");
2017-01-22 19:04:23 +01:00
}
showPageSelection() {
return false;
}
contentView() {
2017-02-06 17:13:41 +01:00
return ContentView.MARKDOWN;
2017-01-22 19:04:23 +01:00
}
transform(pages:TextPage[]) {
var text = '';
pages.forEach(page => text += page.text + '\n');
return [new TextPage({
index: 0,
text: text
})];
}
}