PrintFile

TwinCAT TIA
Local Print

ns=2;s=DEPRAG Smart/Local/Print/PrintFile

Allows to print any files on the default printer set on the system.

Parameters:

    FullFileName
    Full file name incl. file path to the file to be printed via the default printer.
    The file can be, for example, a PDF file (*.pdf) or a Word file (*.doc or *.docx).

Returns:

    PrintFile
    A variable of type OpcMethodReturnValueVoid.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bPrintFile
    A boolean variable that can be used to trigger the execution of the PrintFile command.
    OutputDataPrintFile
    An instance of the "ST_PrintFileOutputData" structure into which the return value of the PrintFile method is written.
    hrPrintFile
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbPrintFile
    An instance of the "FB_Print" function block supplied with the DEPRAG Smart library.
    FullFileName
    A string of type "STRING(80)" specifying the full file name including file path to the file to be printed via the default printer.
    LengthOfFullFileName
    A UINT variable that specifies the length of the full file path.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
  bPrintFile    : BOOL;
  OutputDataPrintFile  : ST_PrintFileOutputData;
  hrPrintFile    : HRESULT;
  fbPrintFile : FB_Print;
END_VAR

hrPrintFile := fbPrintFile.PrintFile( 
       bExecute    := bPrintFile, 
       ConnectionHandle  := depragSmartConnection.ConnectionHandle,
       FullFileName   := 'C:\Test\Doc1.docx',
       LengthOfFullFileName  := SIZEOF('D:\Test\Doc1.docx'),
       OutputData    => OutputDataPrintFile);
IF hrPrintFile <> S_FALSE THEN 
    bPrintFile := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".