Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host our own PDF viewer instead of using Mozilla demo page #878

Merged
merged 13 commits into from
Dec 8, 2020

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Dec 2, 2020

cc @thienlnam

Fixed Issues

Fixes https://github.com/Expensify/Expensify/issues/146082

Tests

  1. Verify PDFs can be viewed on web, desktop, mobile-web and there are no regressions

Screenshots

@marcaaron marcaaron self-assigned this Dec 2, 2020
@botify
Copy link

botify commented Dec 2, 2020

Hey, I noticed you changed some webpack configuration files. This can break production builds. Did you remember to run a production build locally to verify they still work?

@marcaaron
Copy link
Contributor Author

  • Looked into getting an iframe to work, but hit a bunch of CORB and frame ancestor errors that I couldn't easily resolve. There's probably a way to resolve them, but I'd rather look into it another day and just get this working for now as I'm not sure if the iframe will even be suitable once resolving those errors.

  • Hosting these files should work fine. However, I did need to modify a file to whitelist some hosts here. This issue is explained in more detail here -> Allow foriegn origin URLs only for hosted viewers. mozilla/pdf.js#6916

  • Some solutions that I think would be better, but don't feel we need to look into right now:

    • Figure out an iframe solution
    • Use pdf.js via react-pdf or a custom implementation

@botify
Copy link

botify commented Dec 7, 2020

Hey, I noticed you changed some webpack configuration files. This can break production builds. Did you remember to run a production build locally to verify they still work?

1 similar comment
@botify
Copy link

botify commented Dec 7, 2020

Hey, I noticed you changed some webpack configuration files. This can break production builds. Did you remember to run a production build locally to verify they still work?

@marcaaron marcaaron marked this pull request as ready for review December 7, 2020 18:56
@marcaaron marcaaron requested a review from a team as a code owner December 7, 2020 18:56
@botify botify requested review from TomatoToaster and removed request for a team December 7, 2020 18:57
Copy link
Contributor

@TomatoToaster TomatoToaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, a lot simpler than the diff would suggest. The actual code changes LGTM.

Only NAB I had was wondering if all these pdf properties files could be gitingored and generated on build or something since there are so many. But if that seems overly complicated feel free to merge!

@marcaaron
Copy link
Contributor Author

Only NAB I had was wondering if all these pdf properties files could be gitingored and generated on build or something since there are so many. But if that seems overly complicated feel free to merge!

Yeah I brought this up in engineering-chat and the consensus seems to be that it's NBD to keep things like this now and would be more effort to move it over to a separate repo and incorporate into the build process. We can always go down that road later.

@marcaaron marcaaron merged commit 66de36d into master Dec 8, 2020
@marcaaron marcaaron deleted the marcaaron-pdfjs branch December 8, 2020 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants