Ng2-pdf-viewer: New release causing blank pdf

Created on 6 Dec 2016  路  5Comments  路  Source: VadimDez/ng2-pdf-viewer

Thank u very much for this useful plugin!!
Version 0.1.3 causing blank pdf to show.
version 0.1.2 works well.

bug

All 5 comments

@ShayShaked, Could you provide more information?

Of course. I'm developing mobile app with Ionic 2 + Angular 2 using visual studio and ripple emulator on chrome. I installed the plugin about two weeks ago and it worked perfectly well. Until yesterday i had version 0.1.0 . Yesterday my team ran install for ng2-pdf-viewer for the first time on their machines and ran some troubles seeing the pdf, showed as blank sheet. I decide to remove my version on my machine and install the new one. same problem occurred. On chrome dev tools i saw svg's tags that assembles the pdf. Decided to rollback to version 0.1.0 and it worked well. To investigate more i Installed versions 0.1.1 - 0.1.2, and it worked (pdf showed without any problem).
BTW, when opening dev tools while the older versions installed i noticed that the pdf is wrapped inside acanvas..

Just tried clean ionic2 project with pdf viewer - can see the pdf.
Do you have any errors in console ?
Any chance that the styles are overwritten?

I see this (or similar) problem too after updating to 0.1.3. (with 0.1.2, don't see the problem with 0.1.3.)

Error I see on console is this,

TypeError: Cannot read property 'parentNode' of undefined

from this code
canvas.parentNode.insertBefore(_this.buildSVG(viewport, textContent), canvas);

But, more detail of my problem is that

  • only 1st page is not displayed (blank page without any error on console.)
  • when page goes to 2nd page, the above error on console but the page is displayed correctly.
  • From 3rd page to end of all pages, I no longer see my problem.

I am using angular-cli (beta 21) with bootstrap4 alpha5 and don't use ionic for my project FYI. @VadimDez, please let me know if you need more info.

After updating to 0.1.4, the type error above has gone. But all pages are not displayed - all blank pages.

I believe this commit fixed - _"when page goes to 2nd page, the above error on console but the page is displayed correctly."_

But does not fix - _only 1st page is not displayed (blank page without any error on console.)_ to begin with.

I got to set [render-text]="false" to pdf-viewer to display all pages and verified with 0.1.3 same workaround works - 1st page is displayed when [render-text]="false" is set.

([render-text]="false" is set, I see canvas only.)

image

([render-text]="true" is set, I see both svg text layer and canvas.)

image

So, I think real problem here is "textLayer" class on the svg element. For my project with angular-cli, I needed to include pdf_viewer.css either into index.html or angular-cli.json's styles array if I want see pages at least (I mean not a permanent fix) with [render-text]="true" .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RahmatAliMalik5 picture RahmatAliMalik5  路  5Comments

asadullazadeh picture asadullazadeh  路  4Comments

Gianlu82b19 picture Gianlu82b19  路  4Comments

viktorhajer picture viktorhajer  路  7Comments

jgrant95 picture jgrant95  路  6Comments