How to open a PDF in browser using ebase?

View and download documents on various topics e.g. Configuring Ebase Xi under different environmental setups

Moderators: Jon, Steve, Ian, Dave

chsurendra2016
Ebase User
Posts: 9
Joined: Wed Mar 16, 2016 9:01 am

How to open a PDF in browser using ebase?

#1

Postby chsurendra2016 » Thu Jun 02, 2016 8:11 am

Hello,

I am generating a PDF in my application, I want to view the pdf. I am doing something like below.

Code: Select all

var filePath = tables.QUOT_DOCS.getColumnValueOnRow(tables.QUOT_DOCS.FILE_PATH, tables.QUOT_DOCS.getCurrentRow());
    var format = filePath.toString().split(".").pop();
    if (FileServices.existsFile(filePath)) {
        var url = "http://" + system.variables.$UFS_SERVER_NAME.value + ":3030/ufs/FileStream?type=path&filepath=" + filePath + "&format=" + format;
        log("### Called URL : " + url);
        var parms = {};
        parms.returl = form.getReturnUrl();
        form.callUrl(url, parms);
The above code generates the link like below.

Code: Select all

http://10.2.1.168:3030/ufs/FileStream?type=path&filepath=\\10.2.1.168\DocumentImages\Quote_Compare_1180.pdf&format=pdf
When I opened the link in the browser, browser is showing the white screen.

The PDF is available at the following location, and i am able to access the same by using the following.

Code: Select all

file://10.2.1.168/DocumentImages/Quote_Compare_1180.pdf
Any help appreciated
0 x

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

#2

Postby dvanhussel » Thu Jun 02, 2016 9:24 am

Hi,

Is 'FileStream' something (a Java servlet) that you have created yourself? I don't think that it is provided by Ebase.

There are, I tink two solutions for this:

When you need to display files specific for a user(group), not visible for anyone else:

Create a Java servlet. For example, we have created a servlet that can display files a user has uploaded.

But you have to be sure that there is some mechanism to check if this file and folder may be displayed (to this user). Otherwise it will be possible to do something like this:

http://10.2.1.168:3030/ufs/FileStream?t ... some_other_ server_on_your_network\C$\Windows\system32\

Display a file that anyone that uses your website may see:
Create a folder in the /webapps/ufs/ folder containing these files en just link to them like this:

http://10.2.1.168:3030/ufs/documents/Qu ... e_1180.pdf

Regards,

David
0 x


Who is online

Users browsing this forum: No registered users and 20 guests