ngx-extended-pdf-viewer icon indicating copy to clipboard operation
ngx-extended-pdf-viewer copied to clipboard

Print from iPad within browser?

Open jchristensen726 opened this issue 2 years ago • 10 comments

I'm not sure if this is an issue with the viewer, the ipad or the browser but thought I would ask. We are displaying a pdf within our angular site in a modal and only enable the print button. Our user clicks the print button and at first it appears the print dialog pops up showing all of the pages of the pdf. After they select their printer though the preview switches to a view of the web page and that is all that will print.

Has anyone else had this problem? If so, any suggestions on how to actually print the pdf? We can't give them the ability to download it because it has sensitive data.

jchristensen726 avatar Aug 08 '22 15:08 jchristensen726

Let's try to simplify the problem.

  • Does it happen on https://pdfviewer.net, too?
  • Do you also observe it in a fresh project? (see https://pdfviewer.net/extended-pdf-viewer/getting-started - Angular schematic allows you to set up a new PDF viewer project in less than five minutes)
  • Does it also happen if the PDF viewer is not in a modal, but part of the regular HTML page?

stephanrauh avatar Aug 08 '22 17:08 stephanrauh

Yes, it does happen on pdfviewer.net which is not in a modal.

jchristensen726 avatar Aug 08 '22 17:08 jchristensen726

I didn't expect that. Let's do another step towards simplicity: can you reproduce it on https://mozilla.github.io/pdf.js/web/viewer.html? That's the showcase of the base library.

stephanrauh avatar Aug 08 '22 18:08 stephanrauh

On a desktop in chrome it works fine. In safari and chrome on the ipad we get the one page view in the print dialog. If we remove our printer it displays fine in the dialog but then as soon as the printer is selected it goes back to the one page view.

jchristensen726 avatar Aug 08 '22 19:08 jchristensen726

You've tried that on Mozilla's showcase? Strange. It doesn't make sense to me. I wonder if it's really an iPad bug.

stephanrauh avatar Aug 08 '22 19:08 stephanrauh

That's what we were wondering as well. We just started hearing complaints from users in the last few weeks and we've been using a different 3rd party for printing and heard no issues which is why we switched to ngx-extended-pdf-viewer. I haven't been able to find anyone else with the same problem.

jchristensen726 avatar Aug 08 '22 19:08 jchristensen726

In theory, you can debug printing. On an iPad it's a bit cumbersome, but if you've got a Mac and a lightning cable, you can do remote debugging. I've described how to do it here: https://github.com/stephanrauh/ngx-extended-pdf-viewer/issues/1431#issuecomment-1162091452

Two comments up is a short description how printing is implemented (https://github.com/stephanrauh/ngx-extended-pdf-viewer/issues/1431#issuecomment-1161988551). The printer selection happens in iOS code, outside the realm of JavaScript in general and ngx-extended-pdf-viewer in particular. That's why I suspect an iOS bug.

stephanrauh avatar Aug 08 '22 19:08 stephanrauh

You could try using an older iOS version. I'd recommend Browserstack, only it doesn't work in your case: Browserstack runs real devices in a cloud environment, so you probably can't select any printer at all. BTW, that's also the problem with my iPad. After many printerless years, I've bought a printer again, but I don't know how to connect it to my iPad.

stephanrauh avatar Aug 08 '22 19:08 stephanrauh

@timvandermeij Here's a strange bug report. It seems you can print a PDF document using pdf.js on an iPad - but only until you select a printer. When you do that, the preview vanishes. Does this ring a bell? Are pdf.js users reporting similar bugs?

stephanrauh avatar Aug 08 '22 19:08 stephanrauh

I haven't seen such a bug being reported before, but it doesn't sound like a PDF.js bug to me at least given that we have pretty much no control over the print dialogs of browsers from JavaScript.

timvandermeij avatar Aug 13 '22 12:08 timvandermeij

I'm afraid there's nothing I can do. As Tim says, it's probably a bug of the iPad browser.

stephanrauh avatar Aug 27 '22 13:08 stephanrauh