pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 584 forks source link

Print option closes PDF Viewer #278

Closed niczm25 closed 4 years ago

niczm25 commented 4 years ago

Expected Behaviour

The PDF Viewer should be able to preview print options such as selecting printer.

Actual Behaviour

After tapping Print option on a PDF Viewer, the closes before it continues to Print Preview of PDF Viewer

Reproduce Scenario (including but not limited to)

Download PDF file using fileTransfer and open the PDF fileOpener

Steps to Reproduce

Sample source code below for more details

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

I Only tested this on android yet

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Model: Huawei Nova i3 Version: 9.0 Pie

Cordova CLI info

cordova info

Here is the output: cordova-lib@9.0.1 with: cordova-common@3.2.0 cordova-create@2.0.0 cordova-fetch@2.0.1 cordova-serve@3.0.0

Environment: OS: win32 Node: v10.16.2 npm: 6.9.0

Plugin version

cordova plugin version | grep cordova-plugin-file-opener2

Here is the output: "cordova-plugin-file-opener2": "^2.2.1", "cordova-plugin-file-transfer": "^1.7.1",

Sample Code that illustrates the problem

this.fileTransfer .download(url, this.file.dataDirectory + title + '.pdf') .then(entry => { console.log('Download complete: ' + entry.toURL()); this.fileOpener .open(entry.toURL(), 'application/pdf') .then(() => console.log('File is opened')) .catch(e => console.log('Error opening file', e)); }) .catch(err => { console.log(err); });

Logs taken while reproducing problem

shnist commented 4 years ago

Hi @niczm25, thanks for raising this issue. I'm not sure if this is something related to the plugin itself. Once the file has been opened with your chosen app the plugin no longer has any control over what the app does. Sounds like it could be an issue with the PDF viewer app?

pwlin commented 4 years ago

I agree with @shnist. This depends on the PDF viewer you are opening and is not related to this plugin.