nativescript-printer icon indicating copy to clipboard operation
nativescript-printer copied to clipboard

PrintPDF Android (First Page Only)

Open JonasSkovLykke opened this issue 6 years ago • 5 comments

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 ;)

JonasSkovLykke avatar Mar 18 '20 11:03 JonasSkovLykke

Very much needed!

tommag21 avatar Mar 30 '20 11:03 tommag21

+1

brandontulsi avatar May 08 '20 01:05 brandontulsi

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.

tdietsche avatar Oct 12 '21 05:10 tdietsche

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

oliverphaser avatar Jun 08 '22 23:06 oliverphaser

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

tdietsche avatar Jun 08 '22 23:06 tdietsche