We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

base: extract files (blob)

asked 2018-11-24 19:29:13 +0200

sscala gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-11-24 20:26:00 +0200

Ratslinger gravatar image


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).

edit flag offensive delete link more


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.

sscala gravatar imagesscala ( 2018-11-24 20:46:04 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-11-24 19:29:13 +0200

Seen: 417 times

Last updated: Nov 24 '18