How to open a disk file with Capacitor? - vuejs2

I'm saving a file by running the following code with Capacitor:
Filesystem.writeFile({
path: fileName,
data: content,
directory: FilesystemDirectory.Documents,
//encoding: FilesystemEncoding.UTF8
});
Now, I would like to open it (it's a pdf). However, I don't see anything in FileSystem documentation about how to achieve that? I'm missing a FileOpener function.
The goal is that it gets opened with whichever pdf app the user has in the phone.
I'm using Vuejs.

I hope that this is helpful to you, a package for capacitor to read pdf. https://www.npmjs.com/package/capacitor-pdf-viewer-plugin

Related

React-Native with FTP

Is it possible to download/upload files and folders from FTP servers using react native? If yes, react-native-ftp package is the only one that I found which does not seem to work. Did anyone come across such a scenario?
After doing a lot of research, it seems that react-native-ftp is the only package that works, and to download, use the below code:
FTP.downloadFile(/--ftp-file-path, RNFS.ExternalStorageDirectoryPath).then((res) => {console.log("res is", res) })
FYI - RNFS.ExternalStorageDirectoryPath = This is react-native-fs to access your phone's directory and also the path where your files will be downloaded. You can view this in your phone's internal storage.

How to access Downloads folder in taiko automation

I want to verify whether file is downloaded or not after clicking download link.
I am using taiko for automating this task.
I tried to open recent downloads in browser by using these taiko commands goto("chrome://downloads/")
and press(['Control','J']) but both did't work.
Is there any other method to do the same task.And i want know why above commands are not working
Check out this example
You need to first set the download path:
// client function is imported from taiko
await client().send('Page.setDownloadBehavior', {
behavior: 'allow',
downloadPath: downloadPath,
});
You then need to download your file (trigger the action that results in the file getting downloaded - the example uses a click action. And then, after a suitable time has elapsed, you will check the download path that you registered earlier for existence of the file:
expect(path.join(downloadPath, 'foo.txt')).to.exist;

Drag and drop file electron/vue.js

I am trying to make an app with electron and vue.js, in this one I want to make a DropZone for file and just get the path of this file. My problem is that electron is opening my file like a file viewer. How can I disable it with vue.js ?
The will-navigate event is designed to catch/parse dropped files in electron. So it is not a vue.js specific issue.
This snippet will prevent the render process from loading the image as content.
mainWindow.webContents.on('will-navigate', (event) => event.preventDefault());
Reference: https://github.com/electron/electron/issues/5919
API Docs: https://github.com/electron/electron/blob/master/docs/api/web-contents.md#event-will-navigate

Can't import PDF with mpdf

everyone.
I started using mpdf on my website recently. Creating new pdfs is working fine, but i can't import existing ones. I get this error whenever i try to execute the import:
mPDF error: Cannot open ../folder1/folder2/folder3/folder4/folder5/thisisthepdf.pdf !
(that is not the real path)
I included the mpdf in the php. The folder and the files are on chmod 777 and the pdfs are all version 1.4
This is the way i am trying to import.
$mpdf=new mPDF();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile('../folder1/folder2/folder3/folder4/folder5/thisisthepdf.pdf');
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->WriteHTML('Hallo World');
$mpdf->Output();
I tried various ways to import i found on stackoverflow and other sites, but nothing worked. Not even the code from the official mpdf manual i am using (the one above) is working.
Trying to solve this issue for quite a while now, but i am out of ideas. I Hope someone can help me. Thanks in advance!
This error message is raised because of a failing call of a simple fopen(). Which means that the PHP script simply cannot access the file.
So ensure that the path is valid by e.g. passing it to realpath(), as it seems to be a relative path. If this evaluates to false the path is simply wrong. Otherwise it is a permission issue.

Ploblem including a file- Titanium

I get an error while i try to include the js file which is in the same folder. I tried cleaning my project but was of no use.
The console says "error loading path".
Please help.
var db={}
Titanium.include('windows/gallery');
var displayButton= Ti.UI.createButton({
title:'Display',
onClick:function(){
db.gallery.open();
}
});
I have used open function which opens the file. The open file works has no problem.
usually, we use require('files/myFile'), where :
Resources/files/myFile.js is the path (note that require doesn't use the .js)
The js file is NOT at the same level that app.js, but included in Resource folder.
So here, you should do
Titanium.require('windows/gallery');
instead of
Titanium.include('windows/gallery');
By the way, the previous method was Titanium.include('windows/gallery.js');
Note the .js at the end of the include version.
Is it a mobile or desktop version ?