How open or print a file pdf from Sage script
To open a pdf file from an adonix program, you can use the call ETAT From AIMP3.
To indicate that the pdf must be opened on the screen, you have to indicate a destination of type PREVIEW as the print destination.
Below is an example of a program that takes the path of a pdf file as a parameter and opens it to a video.
Warning: this code has been tested for version 6.5.
Subprog APRIPDF(FILENAME) Value Char FILENAME() # the following two are arrays # TBPAR contains the name of the print parameter # TBVAL contains its value Local Char TBPAR(15)(1..6), TBVAL(200)(1..6) GSILENCE = 1 # global variable that inhibits all the messages on the screen TBPAR(1) = "docjoin" # first and only parameter of the "ADOC" press code (attached print) TBVAL(1) = FILENAME # value of parameter Call ETAT("ADOC","","",1,"",TBPAR,TBVAL) From AIMP3 GSILENCE = 0 # restore the value of GSILENCE End
To use this program:
#for local path Call APRIPDF("c:\folder\sub\myfile.pdf") from YSAGEDEV #or for network path Call APRIPDF("\\server\folder\sub\filename.pdf") from YSAGEDEV
But let’s see the call in detail ETAT From AIMP3:
Call ETAT(CODE,DESTINATION,LANGUAGE,TRACE,MSG,TBPAR,TBVAL) From AIMP3
- CODICE it’s the printing code that you find by going to the function GESARP
- DESTINATION it is the printing destination (attention that depending on the type of destination the actions performed may be different)
- LANGUAGE language to print, if it’s blank, the session language is usedWhat changes the language?
- title of the print (parameter X3TIT pass to a Crystal Report)
- il parameter X3LAN pass to Crystal Report, on which any translations can be based
- the folder where find the report (file .rpt), if code print is nel caso il codice di stampa is referred to as multilingual(folders ITA, ENG ecc in REPORT folder)
- TRACE indicates if a log file should be written (1 writes it, 0 does not write it)
- MSG contains any message to be written to the track or to be displayed interactively
- TBPAR contains the list of print parameter names (those found in GESARP)
- TBVAL contains the list of print parameter values, in the same order as TBPAR
It is clear that with this call you can do much more than just open a pdf!
If you have some questions or other examples, write them in the comments.
1 Response
… [Trackback]
[…] Find More Informations here: en.sagedev.it/sagex3/how-open-or-print-a-file-pdf-from-sage-script/ […]