mikecousins/react-pdf-js

Text layer not appearing (just canvas)

Closed this issue · 2 comments

Trying with this PDF.
Am I missing something obvious?

Chrome 62, Windows 10. react-pdf-js v3.0.0.

export default class ReactPDF extends React.Component<any, any> {
  constructor(props: any, state: any) {
    super(props);

    this.state = {
      page: 1,
      pages: [],
    };
  }

  onDocumentComplete = (pages: any) => {
    this.setState({ page: 1, pages });
  }

  onPageComplete = (page: number) => {
    this.setState({ page });
  }

  render() {
    return (
      <div>
        <PDF file="EchoNarcissus.pdf"
          onDocumentComplete={this.onDocumentComplete}
          onPageComplete={this.onPageComplete}
          page={this.state.page} />
      </div>
    );
  }
}

By looking at the source code, I think you're missing that text content layers are not implemented in this implementation. I think you're stuck with my implementation for now 🤣

does react-pdf-js supports Text layer