Viewing complex PDFs is slow
Closed this issue · 2 comments
PDFs with complex (eg. architectural) drawings feel sluggish. This isn't a network issue or document length issue since the app displays one page at a time. Might be a rendering issue; and part of the sluggishness might be because rendering is a blocking event (ie. buttons don't feel as responsive).
Some thoughts / to dos:
- Test pdf w/ complex drawing with other pdf libs. Maybe this is always an issue and isn't specific to
react-pdf-viewer
. - Is there a way to delegate some tasks to Web Workers?
Possible Solution: Convert PDFs to images
Looking at other projects (eg. Fermat's Last Margin and Procore), it might be best for PDFs to be converted to images server-side. The client would then only need to render images, which will be more performant.
Caveat
With this solution, texts will not be rendered as texts. An app like Procore deals with this by separating the text layer from the drawing layer in the PDF. Drawings are sent to the front end as images and the text layer is displayed as native text superimposed on the image.
First stab at a microservice that converts PDFs to PNGs and uploads files to S3: https://github.com/raa-tools/conveyor