简体   繁体   中英

[Solved].net Maui android how to retrieve file from external fileserver

I am making an app that allows you to open and edit a pdf file on tablets. Because i usually work with .NET, i decided to write it in .NET MAUI. That way i also have access to windows tablets. It uses Itext as its main library to read and edit the pdf's. I have an external shared fileserver that anyone can access when they are coneected to the WIFI. I'd like to access that fileserver when i connect from my android tablet using Itext pdfreader.

How do I achieve this correctly?

Am i missing a library or a package which would allow to me to access that file?

Are there options i haven't discovered yet?

This works on windows tablets:

string dest "\\\\Path\\to\\File\\";
string file = "\\\\Path\\to\\File\\file.pdf";
PdfDocument pdfDoc = new PdfDocument(new PdfReader(file), new PdfWriter(dest));

I have tried:

string file = Environment.GetFolderPath(Environment.SpecialFolder.Windows)+ "\\Path\to\File\file.pdf";
string file = "\\\\Path\\to\\File\\file.pdf";

All of them result in file not found

Among the getfolderpath options ive tried a dozen, none of them seem to work.

thank you for your time

So i ended up solving this by transforming the document into a base64 string and sending it through an api that i had.

i used the classic httprequest aproach that you can look up and copy anywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM