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

PDF not show when browser zoom is low or low resolution #299

Closed
1 task done
Sarebok85 opened this issue Mar 13, 2018 · 5 comments
Closed
1 task done

PDF not show when browser zoom is low or low resolution #299

Sarebok85 opened this issue Mar 13, 2018 · 5 comments
Milestone

Comments

@Sarebok85
Copy link

Sarebok85 commented Mar 13, 2018

  • Bug report -> please search issues before submitting

Hi, i have a problem with component. I have a Blob that get URL to use SRC in component and when i down the zoom in the browser (Chrome, for example, but happend in all browser) cant see PDF. I see the LoadingIcon and not appear the PDF.

Html:
<pdf-viewer [src]="urlPDF" style="display: block;"></pdf-viewer>

Component:

this.blobPDF = this.b64toBlob([BLOB], "application/pdf");
this.urlPDF = URL.createObjectURL(this.blobPDF);

B64toBlob Function:

private b64toBlob(b64Data, contentType, sliceSize = 512): Blob {
const byteCharacters = atob(b64Data);
const byteArrays = [];

    for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
      const slice = byteCharacters.slice(offset, offset + sliceSize);

      const byteNumbers = new Array(slice.length);
      for (let i = 0; i < slice.length; i++) {
        byteNumbers[i] = slice.charCodeAt(i);
      }

      const byteArray = new Uint8Array(byteNumbers);

      byteArrays.push(byteArray);
    }

    const blob = new Blob(byteArrays, { type: contentType });
    return blob;
  }

captura

@waterskier2007
Copy link

@VadimDez is there any update on this?

@ragafus
Copy link

ragafus commented Nov 15, 2018

Same problem happening here with the latest version (5.2.1), zoom<=50% and reloading in the same tab. If i open a new tab and go to the URL with the PDF, the issue appears when zoom < 100%.
pdf-viewer

@MilanRaval
Copy link

I have similar issue but for zoom > 0.98. PDF is visible till I set zoom = 0.98 but if zoom is set to 0.99 or more than it shows loading icon.

@VadimDez VadimDez added this to the 6.0.0 milestone Oct 10, 2019
@VadimDez
Copy link
Owner

azhu2 added a commit to azhu2/alexazhu-personal-site that referenced this issue Jan 24, 2021
@neetuvdb
Copy link

can anyone tell me the step, I got many errors like ERROR in node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:100 - error TS2305: Module '"../../../../@types/pdfjs-dist"' has no exported member 'PDFPromise'

I did removed ng_module and update version like:

"ng2-pdf-viewer": "6.1.3",
"pdfjs-dist": "2.5.207",

"ng2-pdf-viewer": "~5.3.4"
"pdfjs-dist": "~2.5.207"

not worked.

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

No branches or pull requests

6 participants