view a PDF from database

Hi, I have a PDF stored in my DB (valentina), I can get the file and download it, and send it as an emailattachment… but how can I view it.

Using htmlviewer.url gives me a lot of can find file errors and stuff…

so is there another way to get the PDF on screen… the file is stored in a BLOB field, and the test PDF is uploaded into the blob using valentina studio, and can be downloaded as a PDF so file is ok into base.

I also tried to make a new PDF, import the PDF from db into this new PDF and show that one in the htmlviewer but still no go.

I only get a lot of:

404: File Not Found

The requested URL “/39412B6FD785D1E414E33B972F96328222CCAACE/files/1179-0156-1173-4985-9854/test.pdf” could not be found. Please check your request and try again.

With MBS DynaPDF?
Or at least running on Mac to use PDFKit?

I think we have a web app example for showing PDF.

I have MBSdynaPDf
But all examples shows from a file and not from DB ?

I was looking into rendertopicture, but then I need to upgrade my dynaPDF to pro license ?

Yes, pro license.
And open import buffer function reads from string or memoryblock

The error “404: File not found” could be an indication that the file (test.pdf in this case) was deleted before the browser was able to download it.
Please, make your file a property of your window and not a property of a method.

Hi Maurizio, I don’t want to download it. I just want my app to get it from my DB (it is stored in a blob field), and show it on screen.
And since htmlviewer can show it when it is a file I would like to know if it can be done without having to downloading it.

Hi Helge,
to display the pdf file in a browser page, the browser itself must download the pdf file.

The problem you have is, possibly, that the value you set in “htmlviewer.url” is referring to a webfile that gets destroyed too early so the browser is unable to download the pdf to display.

Please, define your webfile not as a property of a method but as a property, for example, of a page.
Doing so your webfile stay alive, the browser will be able to download it without the error “404: File not found”
Remember also to set the “MIMEType” property of the webfile to the string value “application/pdf”.

Regards.

Hi Maurizio, you we totally right. I had to move my property to the web-page. Now I could do it… but I also had to make a new PDF and import that PDF into a new created PDF, and then send that to html viewer. I just did not managed to go directly from DB to html viewer.

But thanks!

Hi Helge,
thank you for reporting that the problem is solved.

I don’t think that you need to duplicate or recreate a second pdf just to show it.
Starting from the original pdf you can simply copy it’s content in the data property of the webfile.

Take a look at the WebFile.Data property.

Best regards.