I have documents in different encrypted formats. The decryption process of these I do in memory without saving a copy of the document on disk. What I need is to be able to display these documents directly from memory with PDFTron in Xamarin Forms. How can I achieve this?
I’ve tried to figure out how to work with the OpenNonPDFUri method but it needs an Android.Net.Uri and it’s not possible to get a byte array to it.
Hi,
It is possible to load a document from memory.
You will need to create a PDFDoc object using your byte array.
Once you create the PDFDoc object you can set the PDFDoc in your PDFViewCtrl
PDFDoc mPdfDoc = new PDFDoc(yourArray, arraySize);
mPdfViewCtrl.SetDoc(mPdfDoc);
Please let us know if this solution works for you.
Try this way you tell me. For PDF files it works fine but for files for example with the following extensions which are the ones I need (docx, xlsx, pptx, rtf, txt, jpg) it doesn’t work I get the following error:
“Message: PDF header not found. The file is not a valid PDF document.”
I have tried the way you tell me. And if it lets me view MS Office documents, but other types of formats such as images (jpg, png, bmp or tif) or text files (txt) it does not display them, it gives me an error when converting.