I have made an application which allows me to save a file temporarily as a bunch of bytes in an array. I have this available to me in C# as entity.FileUpload
I have another entity called: entity.Type
which specifies if it is a PDF, DOCX, XLSX and so on... but for the sake of the question, ill only use PDF's
now from this stage, I want to be able to:
- convert the
entity.FileUpload from its bunch of bytes, to a PDF
and then... - Save it on my computer under "C:/Temp";
So my question is: is it possible to convert this byte to a pdf, and then download it locally to my machine? and if yes how would I go about achieving this
If I require different blocks of code for different file types then that is ok, I can progress onto that at a later date, thankyou for any help on this matter
what data I can see under entity.FileUpload
:
How the file is saved:
I am using Javascript on the front end to save to a local database within the application as shown below:
msls.readFile(screen, '.pdf', function (file, data) {
var pdf = myapp.activeDataWorkspace.LocalDatabase.Enquiries.addNew();
pdf.FileName = file.name;
pdf.Type = file.type;
pdf.FileUpload= data;
myapp.activeDataWorkspace.LocalDatabase.saveChanges().done(function () {
msls.showMessageBox('PDF ' + file.name + ' imported.');
}, function (error) {
msls.showMessageBox(error[0].message, { title: "Save Changes Error" });
});
});
- the local database is for testing purposes called "LocalDatabase"
- the table is called "Enquiries"