Focal Point
[SOLVED] open existing PDF in .fex

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3437037666

January 15, 2014, 01:52 PM
folkey
[SOLVED] open existing PDF in .fex
I'm trying to create a .fex which, when run, will open an existing (non-WebFocus) PDF.

From DOS, I can do START, and then the name of the PDF and the PDF will open. I've used the COPY DOS command in unrelated focexecs. But, I'm not able to open a PDF from within a focexec. I've tried all kinds of syntax. Either it says "EDA no data" or it just says it's waiting for a response from the server. I then kill the job after several minutes.

These are some examples I've tried:

-DOS START F:\SYSTEM\IBI\APPS\Dashboard_iPad\Bud.pdf
-DOS START \\DHCD\SHARES\Dashboard_iPad\Bud.pdf
-DOS START http://caliban:8080/ibi_apps/Dashboard_iPad/Bud.pdf
-DOS START /approot/Dashboard_iPad/Bud.pdf

The above are variations of the path of the file that work in other focexecs for other purposes.

This is an abbreviated sample of a DOS COPY command I've used succesfully elsewhere:
-DOS COPY F:\SYSTEM\IBI\APPS\Dashboard_iPad\Indirect_04_Report.txt File2

I found a posting from someone on Focal Point with the same problem from a few years ago. He suggested using something like:

-DOS EXEC AcroRd32.exe F:\SYSTEM\IBI\APPS\Dashboard_iPad\Bud.pdf

But I get an error about not being able to use EXEC. I get similar error messages when trying some other DOS commands which should (or might otherwise) open a file. I don't get that error with START, but it either says "no data" or does nothing.

I'm thinking the problem deals with how I'm specifying the path of the file, and that WebFocus can't find it. But, on the other hand I can do DOS COPY with the same formatting of a file, and it can be found by WebFocus.

Thanks,

This message has been edited. Last edited by: <Kathryn Henning>,


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
January 15, 2014, 02:14 PM
Prarie
Can you use a URL link?


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Prarie,

My 3rd example:

-DOS START http://caliban:8080/ibi_apps/Dashboard_iPad/Bud.pdf

would be the URL link. That gives me "EDA no data"

To go into more detail.....

I want the PDF to open when a user clicks a button on an html page. There are several buttons for several PDFs. I can use a button - technically a text box - and add hyperlink properties and point to a URL - /approot/Dashboard_iPad/Bud.pdf. This works fine.

However, I'd like to run some WebFocus code in the background before the PDF opens (when the user pushes the button). I can put that code in a .fex, but I can't figure out the DOS (or whatever) command to open the PDF from within that .fex (after that initial WebFocus code runs).


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
Use EDAGET

EX EDAGET PDF,baseapp/mypdf.pdf,b


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
Tony,

I tried your example, along with many variations. Either it comes up with an empty PDF, or it gives me error messages (when the syntax obviously wasn't right).

I even copied my PDF to baseapp, but it still opened an empty PDF.

I noticed a post on Focal Point from August, 2013 where user linnex says EDAGET doesn't work for binary-type files, such as PDF.


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
Try -WINNT instead of -DOS. We do this often...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
Tom,

I tried -WINNT, but I don't see much difference from when I use -DOS. It either says "EDA no data", or it just keeps waiting to do something in the browser until I kill it.


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
quote:
I'm trying to create a .fex which, when run, will open an existing (non-WebFocus) PDF.


I think there's a semantics issue here. What do you mean when you say the fex should "open" the existing PDF?

There's really nothing much the fex (running on the WFRS) can do to interpret the PDF's contents.

Or do you mean you want the fex to cause the PDF file to open in the browser? For that, the fex just needs to return a result page with an appropriate link to the PDF, and leave it to the browser to request the content.
EDAGET syntax: EDAGET and EDAPUT Questions
EDAPUT syntax: EDAPUT Syntax

I tried EDAGET with an externally created PDF file and it does not work, however it does work with a PDF generated by WF. It also works with other binary files like PNG or GIF images:

EX EDAGET PNG,baseapp/edaget_test,b
EX EDAGET PDF,baseapp/edaget_test2,b
EX EDAGET XML,baseapp/edaget_test,t



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
J.

I'd like the "fex to cause the PDF file to open in the browser." I'm thinking the key to your suggestion is "appropriate" link. In other situations in other focexecs, I've used forward slashes, backward slashes, full path, abbreviated path..... but none of that is working here.

Going back to my original post, I can use the START command to open the PDF from the DOS window. In other focexecs, I can use the DOS COPY command to copy files. But I haven't figured out the correct syntax to use the DOS START command in a focexec.


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
Francis,

Bummer. The PDF's I'm trying to open were not created by WF.


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
Here's a method to open a PDF from a fex. The file must exist in a directory that the web server can read.

-HTMLFORM BEGIN
<html>
<head>

<!--
<meta http-equiv="refresh" content="0;url=!IBI.AMP.REPORT_FILE;">
<meta http-equiv="refresh" content="0;url=C:\ibi\srv53\wfs\edatemp\ts000001\output01.pdf">
<meta http-equiv="refresh" content="0; url=!IBI.AMP.FILE_PATH;!IBI.AMP.FILE_NAME;">
-->

<meta http-equiv="refresh" content="0; url=/approot/baseapp/web_test.pdf">

</head>
</html>
-HTMLFORM END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Apologies, but I have a day job also ... Wink

I have tried with PDF version documents of 1.4, 1.5 and 1.6. Only 1.4 opens OK with the EDAGET method. 1.5 and 1.6 do not.

Please remember that, as mentioned is various posts, EDAGET is an internal process and is not supported.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
ah
like a redirect.
works!
brilliant, Francis!!!




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Francis,

That did it! It works great. I added my code to the .fex, which runs before the PDF is open (to log when users run a focexec) and that works fine.

I don't know too much about html coding (though, I've had to learn some due to how the GUI doesn't always work too well in Dev Studio).

I don't seem to remember how to make a comment, but I guess < !-- and --> must be the start and end of a comment because I removed what you had in there. I guess you were showing me other examples of how to show the path of the PDF.


Thanks,

~Mark

WebFocus Client 7.703
WebFocus Reporting Server 7.705
Windows Server 2008 R2
Dev Studio 7.703
Apache Tomcat/6.0.20
Excel, PDF
IWAY DM Server 7.705
DataMigrator 7.705
Mark, yes, you have it right - those are the start and end comment HTML tags. I put those in there to show other examples - maybe you need to embed a WebFOCUS parameter value in the file name...

I'm glad this worked for you.

The only problem I see with this method is that quite often people do not have a way to get the PDF file to the web server, which in your case is not an issue.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Here's a version using the HTML5 embed tag, where you can embed the PDF in an HTML page, thus including non-PDF content.

Tested in Chrome and Firefox. It does not work in Internet Explorer 10, for the obvious reason that Microsoft does not follow standards.

-HTMLFORM BEGIN
<!DOCTYPE html>
<html>

<title>View PDF</title>

<body>

<div>
    <span>Here is the PDF</span>
</div>

<div>
    <embed src="/approot/baseapp/web_test.pdf" width="600" height="900" type="application/pdf">
</div>

</body>

</html>
-HTMLFORM END

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
This one uses the HTML5 object tag - still no good for Internet Explorer.

-HTMLFORM BEGIN
<!DOCTYPE html>
<html>

<title>View PDF</title>

<body>

<div>
    <span>Here is the PDF</span>
</div>

<div>
    <object data="/approot/baseapp/web_test.pdf" type="application/pdf" width="600px" height="900px">
        <param name="wmode" value="transparent" />
        <param name="allowFullScreen" value="true"></param>
        <embed src="/approot/baseapp/web_test.pdf"
               type="application/pdf"
               width="600px" height="900px"
               allowscriptaccess="always"
               allowfullscreen="true"
               wmode="transparent"
               />
    </object>
</div>

</body>

</html>
-HTMLFORM END

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
i hate IE10. Mad
i want that on a tshirt
no wait, on my vanity plate!
1H81ETEN




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Ditto Susannah! I've set mine to open ALL sites in compatibility mode, but I still get grief. And Adobe isn't helping either.....


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
quote:
Originally posted by Francis Mariani:

The only problem I see with this method is that quite often people do not have a way to get the PDF file to the web server, which in your case is not an issue.


If this is needed I'd suggest PSCP.EXE (download for free from the PuTTY website. Works great for Windoze -> Linux environments.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
Yes Susannah...I've had IE10 for 6 weeks now and I'm having flash backs of Dialup.
I can't get this to run to save my life. It appears that it cannot see the file, which is in the path. I have

<meta http-equiv="refresh" content="0; url=/approot/madap_letters/vpdoc.pdf">


. . . and I keep getting "The requested resource (/approot/madap_letters/vpdoc.pdf) is not available."

I apparently don't have visibility to the file? It's in the path, but I can't get it to return for love or money.



If you're in a two-tier environment, the PDF is on the reporting server and the URL references the web server. If possible, on the web server you can map a drive pointing to the reporting server. Or try using EDAGET.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Hi Francis,

I'm currently on version 8.201M

Do you have an example of how to render an existing pdf file from a fex (like the example you showed a few years ago)?

And where does the pdf file need to be?

Thanks in advance!!!


WebFocus 8.201M, Windows, App Studio
The HTML method should work in WF 8.2.01M.

I don't have access to WF 8.2.01M so I cannot test the EDAGET method.

Hopefully you've read here that some (many) externally created PDF files will not work with EDAGET because of the version of Adobe PDF used.

With EDAGET the PDF file must be on the reporting server. With the HTML method, the PDF file must be in a location that the web server can reference.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Francis,

Did you have any suggestions for destroying the file after its been sent to the client? I don't want to leave these files to live out there in perpetuity. My current thought process is to clean up the RS as soon as the file has been copied to the web server, and then run a shell script with cron to destroy any file older then 5 minutes in my destination folder on the web server... but I'd like something cleaner.


Any thoughts?


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
I'm not sure if there's anything cleaner. Perhaps the web server (Tomcat, Websphere, ...) have built-in tools...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Run the following code:
-* File: IBFS:/Dev/WFC/Repository/Vendor/Doug/OpenPDF.fex Created by WebFOCUS AppStudio
-* Douglas Lee, AKA: WebFOCUS Doug
TABLE FILE CAR
HEADING CENTER
"Can we open a PDF from within a fex?"
"Yes, We can do that in WebFOCUS!"
BY  CAR.ORIGIN.COUNTRY AS ''
WHERE COUNTRY NE COUNTRY
ON TABLE SET EMPTYREPORT ON
ON TABLE NOTOTAL
ON TABLE SET STYLE *
GRID=OFF, BORDER=OFF,$
TYPE=HEADING, LINE=1, URL=http://www.thefamilee.net/DEL/Resume%20of%20Douglas%20Lee.pdf, target=new,$
TYPE=HEADING, LINE=2, URL=HTTP://TheFamiLee.net/CharicatureOfDouglasLee.jpg, target=new,$
ENDSTYLE
END
I just had to chime in here... Smiler

This message has been edited. Last edited by: Doug,




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206