Base: extract files (blob)

I have a database for scientific articles, which come as PDF.

I noticed, it is fairly easy to add PDFs to a LO-database by using a form and the image-control.

Apparently, the whole PDF is saved and not just the first page that is displayed in the image-control (I checked BLOB length and it corresponds to respective filelength).

But how can I extract the files saved in the database again or open the PDF in an external viewer?
I did not find any functionality in the image-control.

Hello,

The image control is not meant for viewing documents. There are two methods to attach documents: as you have done or store a link to the document. The latter requires little storage in the database and is much easier to view externally using a simple macro:

Sub GetURL
    oForm = ThisComponent.Drawpage.Forms.getByName("YOUR_INTERNAL_FORM_NAME")
    DocCtl = ThisComponent.getCurrentController()
    oField = oForm.getByName("CONTROL_NAME")
    oButton = oForm.getByName("PUSH_BUTTON_NAME")
    CtlView = DocCtl.GetControl(oField)
    oButton.TargetUrl = CtlView.Text
end sub

attached to After record change event of form and on the push button property Action set to Open document/web page you only need a click of the button to open the link.

Now if you are going to have the document embedded as an image, the image data needs to be output to a file to then be opened with the appropriate viewer and when done remove this temporary file. This post → [Tutorial] Pictures in Base will present some methods for this (code in samples).

thanks!
the problem is that I require remote access, so all data - including large PDFs - has to be stored centrally.
the “Stuff_We_Own_Sample - DACM update.odb” appears to have built in almost everything I was looking for.