Open pdf file from Natural

Anybody tried to open a PDF file from Natural ?

I have the following code :

0030 DEFINE DATA
0040 LOCAL
0050 1 #VIEWER HANDLE OF OBJECT
0060 1 RC (I4)
0070 1 PARM (A) DYNAMIC
0080 1 OBJ-CLASS (A35) CONST <‘AcroPDF.PDF’>
0090 1 SVAR (L)
0100 END-DEFINE
0110
0120 CREATE OBJECT #VIEWER OF CLASS OBJ-CLASS GIVING RC
0130
0140 IF RC NE 0
0150 ESCAPE ROUTINE
0160 END-IF
0170
0180 PARM := ‘C:\temp\ud.pdf’
0190 ** Load
0200 SEND ‘LoadFile’ TO #VIEWER
0210 WITH PARM
0220 RETURN SVAR
0230
0240 write SVAR
0250
0260 #VIEWER := NULL-HANDLE
0270 END

I can see AcroRd32.exe in my taskmaneger, but the LoadFile returns false, and nothings happens.

Anybody with an idea ?

Thanks Claus

Hi Claus;

I use usr1052.

define data local
1 usr1052l
2 os-command (a253)
2 response (i4)
end-define
*
move ‘c:\program files\adobe\acrobat 5.0\reader\acrord32.exe’ to os-command
callnat ‘usr1052n’ usr1052l
end

to open a pdf, rather than just start acrobat, add a reference to os-command
e.g. c:\mypdf,pdf

steve

Hi Steve,

I’m not so happy about the solution with the full ‘path’ to AcroRd32.exe, because I know that people have different versions, and perhaps also different paths to this.

But I did find a solution that works :

0080 MOVE ‘CMD.EXE /C C:\TEMP\UD.PDF ASYNCH’ TO OS-COMMAND
0090 CALLNAT ‘USR1052N’ USR1052L

I use the ASYNCH because the user should be able to continue working in Natural.

The only ‘problem’ is that I get a CMD window, but it closes when I exit the viewer, so I think I can live with it.

Thanks for the reply, it was even simpler than my solution.

Claus

Where does one find USR1052?

There is a wonderful library called SYSEXT, that has several hundred or so, “utilities”.

Some shops prevent users from logging on to SYSEXT. So, try LOGON SYSEXT. If you get a security error message, or if the logon simply doesn’t work, you are in one such shop. The solution would be to explain to the DBA, or your manager, that you require access to USR1052. They may simply move the routine to your library.

Once you get to SYSEXT (assuming you can), run the program called MENU.

steve

Natural Studio provides a plug-in to SYSEXT. I’ve attached a Word document containing the toolbar icon. If you can’t find the SYSEXT Utility toolbar or icon, click Tools –> Configuration Tools –> Plug-in Manager. On the SYSEXT Utility context menu (right-click SYSEXT Utility) click Activate.
SYSEXT icon.doc (23.5 KB)