前提・実現したいこと
ページにPDFを埋め込んで表示させる形式を作っております。
従来、ブラウザではシンプルなPDF表示になっておりますが、GoogleChromeの最新版では表示方法によって、見づらいものになってしまうようです。(PDFの左側に各ページのプレビューが表示されるようになりました。)
今回、PDFの表示について変えて見やすいものにしたいと考え、
以下のようにできないかと考えております。
・以前までのGoogleChromeのようにプレビューが表示されない
・ファイルのダウンロードが可能である
・画面の拡大・縮小が可能
正直、今までにこういったことをしてきていないので何の言語を使用したらいいかなどもわかりません。いろいろ検索した結果、CSSを使用するとでき得るということが分かったため、また、今までに使用してきたHTMLやJavaScriptを使用してできないかと思っています。
補足
検索の過程で出てきたPDF.jsを活用したいと考えています。また、このブログでPDF.jsについて説明されており、具体例が紹介されているので、同じものにしたいのですが、ソースコードを見て真似してもなぜか上手くいきません。
###エラーについて
Access to XMLHttpRequest at '~/mozilla.github.io/web/locale/locale.properties' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. getL10nData @ viewer.js:14134 viewer.js:13755 ~/mozilla.github.io/web/locale/locale.properties not found. (anonymous) @ viewer.js:13755 viewer.js:13756 "ja-jp" resource not found (anonymous) @ viewer.js:13756 locale/locale.properties:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-viewThumbnail.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-viewThumbnail.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-viewOutline.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-viewOutline.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-viewAttachments.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-viewAttachments.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-viewLayers.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-viewLayers.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-sidebarToggle.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-sidebarToggle.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-search.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-search.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-pageUp.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-pageUp.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-pageDown.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-pageDown.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-presentationMode.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-presentationMode.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-openFile.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-openFile.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-print.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-print.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-download.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-download.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-bookmark.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-bookmark.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-secondaryToolbarToggle.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-secondaryToolbarToggle.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-zoomOut.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-zoomOut.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-zoomIn.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-zoomIn.svg:1 Failed to load resource: net::ERR_FAILED viewer.html:1 Access to image at '~/mozilla.github.io/web/images/toolbarButton-menuArrow.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. toolbarButton-menuArrow.svg:1 Failed to load resource: net::ERR_FAILED pdf.worker.js:16 Uncaught SyntaxError: Cannot use import statement outside a module viewer.js:14134 #loading_error is undefined. getL10nData @ viewer.js:14134 viewer.js:14134 #error_version_info is undefined. getL10nData @ viewer.js:14134 viewer.js:14134 #error_message is undefined. getL10nData @ viewer.js:14134 pdf.js:2865 Uncaught (in promise) Error: Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined". at pdf.js:2865 DevTools failed to load SourceMap: Could not load content for ~/mozilla.github.io/build/pdf.js.map: System error: net::ERR_FILE_NOT_FOUND DevTools failed to load SourceMap: Could not load content for ~/mozilla.github.io/web/viewer.js.map: System error: net::ERR_FILE_NOT_FOUND
回答1件
あなたの回答
tips
プレビュー