EddyVerbruggen / nativescript-printer

:fax: Send an image or the screen contents to a physical printer
MIT License
36 stars 13 forks source link

PrintPDF Android (First Page Only) #24

Open JonasSkovLykke opened 4 years ago

JonasSkovLykke commented 4 years ago

Hey.

First off, Thank You for making printing of PDF possible :)

I have testet this plugin now with a PDF with more than one page.

iOS: Works like a charm. previews all pages, prints all pages ;)

Android: Only previews the first page, and only prints the first page. :/

From what I can read in printer.android.js The PDF is rendered into a single image. And only page 0. Maybe theres something there that needs a little extra love :)

In advance. TY ;)

tommag21 commented 4 years ago

Very much needed!

brandontulsi commented 4 years ago

+1

tdietsche commented 2 years ago

The problem is obvious, look at the "printPDF" function on line 96 of this source file: https://github.com/EddyVerbruggen/nativescript-printer/blob/master/src/printer.android.ts

It's only printing page [0], but s/b looping thru all pages as shown in this doc page for the underlying android class: https://developer.android.com/reference/android/graphics/pdf/PdfRenderer

Who wants to fix it? I'm a "read-only" github user!! No idea how to submit code changes to a NativeScript plugin.

oliverphaser commented 2 years ago

@EddyVerbruggen, I made a PR for this issue. See PR #33. I tested and it works for me. Please have a look on it.

tdietsche commented 2 years ago

@oliverphaser, THANK YOU! We will test this soon in our app and then let you know our test results.