Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf opened in an external app cannot save changes #323

Closed
ToMoAxi opened this issue Jul 15, 2021 · 1 comment
Closed

pdf opened in an external app cannot save changes #323

ToMoAxi opened this issue Jul 15, 2021 · 1 comment

Comments

@ToMoAxi
Copy link

ToMoAxi commented Jul 15, 2021

Expected Behaviour

I open a pdf with the file-opener2 plugin and the acrobat reader can save its changes.

Actual Behaviour

The pdf opens correctly but the changes (for example, the signature) are not saved. I used Adobe Acrobat v21.6.0.18197

The file exists in the directory.

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

Android 11
Cordova 9.0.0
Android Platform 8.0.0

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

via AVD

Plugin version

3.0.5

Sample Code that illustrates the problem

// externalDataDirectory = file:///storage/emulated/0/Android/data/[APP_ID]/files/
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dir) {
	dir.getFile("15-07-21-174005_000010009647_SR.pdf", {}, function (file) {
		// nativeURL = file:///storage/emulated/0/Android/data/[APP_ID]/files/15-07-21-174005_000010009647_SR.pdf
		// also tried file.toInternalURL() = "cdvfile://localhost/files-external/15-07-21-174005_000010009647_SR.pdf"
		cordova.plugins.fileOpener2.open(file.nativeURL, "application/pdf", {
			success: function () {
				...
			},
			error: function (oError) {
				...
			},
		});
	}, function (oError) {
		...
	});
});

config.xml from the app:

<access origin="*"/>
<allow-intent href="*" />
<allow-navigation href="*" />

<platform name="android">
	<icon src="www/offlineRes/img/mobile-icons/logo-header.png" density="xhdpi"/>
	<preference name="android-minSdkVersion" value="21"/> <!--Android 4.1-->
	<preference name="android-targetSdkVersion" value="29"/>
	<preference name="AndroidExtraFilesystems" value="files,files-external,documents,sdcard,cache,cache-external,root"/>
	<preference name="AndroidPersistentFileLocation" value="Internal" />
	<preference name="AndroidPersistentFileLocation" value="Compatibility" />
	<preference name="loadUrlTimeoutValue" value="700000"/>

	<custom-config-file parent="/*" target="AndroidManifest.xml">
		<uses-permission android:name="android.permission.CAMERA"/>
		<uses-feature android:name="android.hardware.camera"/>
		<uses-feature android:name="android.hardware.camera.autofocus"/>
	</custom-config-file>
	<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
		<application android:usesCleartextTraffic="true" />
		<application android:networkSecurityConfig="@xml/network_security_config" />
	</edit-config>
	<resource-file src="merges/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
</platform>

<allow-navigation href="http://*/*"/>
@shnist
Copy link
Collaborator

shnist commented Jan 31, 2023

hi, this is a duplicate of #164 . The plugin doesn't support the editing of files. I think I will update the README to make this clear.

@shnist shnist closed this as completed Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants