Skip to content

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

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

Merged
merged 13 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
extends: 'expensify',
parser: 'babel-eslint',
ignorePatterns: 'src/vendor',
rules: {
'react/jsx-filename-extension': [1, {extensions: ['.js']}],
},
Expand Down
5 changes: 5 additions & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ module.exports = {
patterns: [
{from: 'web/favicon.png'},
{from: 'web/favicon-unread.png'},

// These files are copied over as per instructions here
// https://github.com/mozilla/pdf.js/wiki/Setup-pdf.js-in-a-website#examples
{from: 'src/vendor/pdf-js/web', to: 'pdf/web'},
{from: 'src/vendor/pdf-js/build', to: 'pdf/build'},
],
}),

Expand Down
3 changes: 1 addition & 2 deletions src/CONST.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const CLOUDFRONT_URL = 'https://d2k5nsl2zxldvw.cloudfront.net';
const MOZILLA_PDF_VIEWER_URL = 'http://mozilla.github.com/pdf.js/web/viewer.html';

const CONST = {
CLOUDFRONT_URL,
MOZILLA_PDF_VIEWER_URL,
PDF_VIEWER_URL: '/pdf/web/viewer.html',
EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/PDFView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const defaultProps = {

const PDFView = props => (
<WebView
source={{uri: `${CONST.MOZILLA_PDF_VIEWER_URL}?file=${encodeURIComponent(props.sourceURL)}`}}
source={{uri: `${CONST.PDF_VIEWER_URL}?file=${encodeURIComponent(props.sourceURL)}`}}
style={props.style}
/>
);
Expand Down
Binary file added src/vendor/pdf-js/web/cmaps/78-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78ms-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/78ms-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/83pv-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/90ms-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/90ms-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/90msp-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/90msp-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/90pv-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/90pv-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Add-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Add-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Add-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Add-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-0.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-1.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-2.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-3.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-4.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-5.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-CNS1-6.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-GB1-0.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-GB1-1.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-GB1-2.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-GB1-3.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-GB1-4.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-GB1-5.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-0.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-1.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-2.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-3.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-4.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-5.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Japan1-6.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Korea1-0.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Korea1-1.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Adobe-Korea1-2.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/B5pc-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/B5pc-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/CNS-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/CNS-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/CNS1-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/CNS1-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/CNS2-H.bcmap
Binary file not shown.
3 changes: 3 additions & 0 deletions src/vendor/pdf-js/web/cmaps/CNS2-V.bcmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
�RCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE�CNS2-H
Binary file added src/vendor/pdf-js/web/cmaps/ETHK-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/ETHK-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/ETen-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/ETen-B5-V.bcmap
Binary file not shown.
3 changes: 3 additions & 0 deletions src/vendor/pdf-js/web/cmaps/ETenms-B5-H.bcmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
�RCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE� ETen-B5-H` ^
Binary file added src/vendor/pdf-js/web/cmaps/ETenms-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Ext-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Ext-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Ext-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Ext-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GB-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GB-EUC-V.bcmap
Binary file not shown.
4 changes: 4 additions & 0 deletions src/vendor/pdf-js/web/cmaps/GB-H.bcmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
�RCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE!!��]aX!!]`�21�> �p �z�$]��"R�d�-U�7�*�4�%�+ �Z �{�/�%�<�9K�b�1]�.�"� �`]�,�"]�
�"]�h�"]�F�"]�$�"]��"]�`�"]�>�"]��"]�z�"]�X�"]�6�"]��"]�r�"]�P�"]�.�"]� �"]�j�"]�H�"]�&�"]��"]�b�"]�@�"]��"]�|�"]�Z�"]�8�"]��"]�t�"]�R�"]�0�"]��"]�l�"]�J�"]�(�"]��"]�d�"]�B�"]� �"X�~�']�W�"]�5�"]��"]�q�"]�O�"]�-�"]� �"]�i�"]�G�"]�%�"]��"]�a�"]�?�"]��"]�{�"]�Y�"]�7�"]��"]�s�"]�Q�"]�/�"]��"]�k�"]�I�"]�'�"]��"]�c�"]�A�"]��"]�}�"]�[�"]�9
Expand Down
Binary file added src/vendor/pdf-js/web/cmaps/GB-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBK-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBK-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBK2K-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBK2K-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBKp-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBKp-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBT-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBT-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBT-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBT-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBTpc-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBTpc-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBpc-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/GBpc-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKdla-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKdla-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKdlb-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKdlb-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKgccs-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKgccs-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKm314-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKm314-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKm471-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKm471-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKscs-B5-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/HKscs-B5-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Hankaku.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Hiragana.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSC-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSC-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSC-Johab-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSC-Johab-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSCms-UHC-H.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSCms-UHC-HW-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSCms-UHC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSCpc-EUC-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/KSCpc-EUC-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Katakana.bcmap
Binary file not shown.
36 changes: 36 additions & 0 deletions src/vendor/pdf-js/web/cmaps/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
%%Copyright: -----------------------------------------------------------
%%Copyright: Copyright 1990-2009 Adobe Systems Incorporated.
%%Copyright: All rights reserved.
%%Copyright:
%%Copyright: Redistribution and use in source and binary forms, with or
%%Copyright: without modification, are permitted provided that the
%%Copyright: following conditions are met:
%%Copyright:
%%Copyright: Redistributions of source code must retain the above
%%Copyright: copyright notice, this list of conditions and the following
%%Copyright: disclaimer.
%%Copyright:
%%Copyright: Redistributions in binary form must reproduce the above
%%Copyright: copyright notice, this list of conditions and the following
%%Copyright: disclaimer in the documentation and/or other materials
%%Copyright: provided with the distribution.
%%Copyright:
%%Copyright: Neither the name of Adobe Systems Incorporated nor the names
%%Copyright: of its contributors may be used to endorse or promote
%%Copyright: products derived from this software without specific prior
%%Copyright: written permission.
%%Copyright:
%%Copyright: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
%%Copyright: CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
%%Copyright: INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
%%Copyright: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
%%Copyright: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
%%Copyright: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
%%Copyright: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
%%Copyright: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
%%Copyright: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
%%Copyright: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
%%Copyright: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
%%Copyright: OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
%%Copyright: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%%Copyright: -----------------------------------------------------------
Binary file added src/vendor/pdf-js/web/cmaps/NWP-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/NWP-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/RKSJ-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/RKSJ-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/Roman.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniCNS-UCS2-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniCNS-UCS2-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniCNS-UTF16-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniCNS-UTF32-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniCNS-UTF8-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniCNS-UTF8-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UCS2-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UCS2-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UTF16-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UTF16-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UTF32-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UTF32-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UTF8-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniGB-UTF8-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UCS2-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UCS2-HW-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UCS2-HW-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UCS2-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UTF16-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UTF32-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UTF8-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJIS-UTF8-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJISPro-UCS2-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniJISPro-UTF8-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UCS2-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UCS2-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UTF16-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UTF16-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UTF32-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UTF32-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UTF8-H.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/UniKS-UTF8-V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/V.bcmap
Binary file not shown.
Binary file added src/vendor/pdf-js/web/cmaps/WP-Symbol.bcmap
Binary file not shown.
Binary file not shown.
Loading