-
Notifications
You must be signed in to change notification settings - Fork 55
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
Issue with some pdfs #369
Comments
I've seen this before. I see a ton of errors in the console like this:
I think this is a bug in how I've set up PDF.js and remember seeing something about it in the FAQ. Hopefully any easy fix with easy confirmation. |
I tried hypothesis on that pdf as I recall them using pdf.js and it seems to work fine in their embedding |
I suppose that is their embedding https://github.com/hypothesis/pdf.js-hypothes.is |
I made some changes to try and follow instructions for cmaps here diff --git a/webpack.config.ts b/webpack.config.ts
index ab3abd69..bb1c18ff 100644
--- a/webpack.config.ts
+++ b/webpack.config.ts
@@ -239,6 +239,12 @@ export default [
chunks: ['background'],
filename: 'background.html',
}),
+ new CopyPlugin([
+ {
+ from: 'node_modules/pdfjs-dist/cmaps/',
+ to: 'assets/pdfjs-cmaps/',
+ },
+ ]),
...(isDev
? [
new HardSourcePlugin({ diff --git a/src/renderer/components/content-types/files/PdfContent.tsx b/src/renderer/components/content-types/files/PdfContent.tsx
index bcf633ce..ac0d1907 100644
--- a/src/renderer/components/content-types/files/PdfContent.tsx
+++ b/src/renderer/components/content-types/files/PdfContent.tsx
@@ -118,7 +118,14 @@ export default function PdfContent(props: ContentProps) {
<>
{header}
{buffer ? (
- <Document file={{ data: buffer }} onLoadSuccess={onDocumentLoadSuccess}>
+ <Document
+ file={{ data: buffer }}
+ onLoadSuccess={onDocumentLoadSuccess}
+ options={{
+ cMapUrl: '/assets/pdfjs-cmaps/',
+ cMapPacked: true,
+ }}
+ >
<Page
loading=""
pageNumber={pageNum} But I see no requests for cmaps and issues still seem to be present. |
This seems relevant wojtekmaj/react-pdf#275 |
Tried following to see if the problem was with electron: document.documentElement.innerHTML = "<iframe style='width: 100%;height:100%;top:0;left:0;position:fixed;'src='https://via.hypothes.is/https://tools.ietf.org/pdf/rfc2557.pdf#annotations:zUk5UDM2Eeq1FYMkzSVmuw'>" Seems to work as expected and there seems to be no requests to cmap files |
I am now suspecting that hypothesis might be doing this |
Surprisingly setting a following setting |
This does not seem ideal as per docs https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib.html
|
Some poking around debugger also showed that font that causes error is 'Courier' with 'monospace' fallback. However there seems to be no compiled glimpse and that is why those errors are logged. |
For whatever reason pushpin seems to have issue with a following pdf
https://tools.ietf.org/pdf/rfc2557.pdf
The text was updated successfully, but these errors were encountered: