Yaza Yaza - 5 months ago 81
C# Question

Open pdf from byte array ios xamarin c#

I have a byte array that contains a pdf document and I want to open it in an ios application.

This is my code so far:

public static string WriteFileFromByteArray(string fileName, byte[] bytes)
var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var filePath = Path.Combine(documentsPath, fileName);
File.WriteAllBytes(fileName, bytes);

return filePath;

Does any one know how to do so?

Answer Source

Not sure where exactly you are stuck up. But there is an issue in the below line of code you have posted.

File.WriteAllBytes(**fileName**, bytes);// on this code you are using filename instead of filepath.

Use filePath variable instead of fileName as it just contains the name of a file.

Refer the below link for PDF viewer.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download