PrintNode Connector version 2.2.7702.0 and up provides developers with extensible support to send RAW printing commands to a printer through the PrintNode service.
Retrieve PrintNode Connector Symbols
Before starting, ensure PrintNode Connector is installed (see Install and Uninstall PrintNode Connector). Once PrintNode Connector is installed, you can download the symbols and use the RAW printing function. Complete the following to obtain the symbols:
- Create an AL project in Visual Studio Code.
- Set the launch.json file in the project to the Microsoft Dynamics 365 Business Central sandbox.
{
“version”: “0.2.0”,
“configurations”: [
{
“type”: “al”,
“request”: “launch”,
“name”: “Microsoft cloud sandbox”,
}
]}
- Include the PrintNode Connector and IWorks Common extensions as dependencies in the dependencies portion of the app.json file.
{ "version": "0.2.0", "configurations": [ { "type": "al", "request": "launch", "name": "Microsoft cloud sandbox", } ] }
“dependencies”: [
{
“appId”: “b0c8bcc7-2924-4cd2-8562-4e71ebd07323”,
“publisher”: “Insight Works”,
“name”: “Insight Works PrintNode Connector”,
“version”: “2.2.7702.0”
},
{
“appId”: “ba1776ba-1198-4b4c-a61e-c4612f1880d5”,
“publisher”: “Insight Works”,
“name”: “IWorks Common”,
“version”: “2.0.0.0”
}
]
- Input AL: Download Symbols into the search window (downloads the symbol file from the sandbox into the .alpackages project folder).
RAW Printing Function
The RAW printing function is contained in Codeunit “IWX PrintNode API Mgt.”.
PrintRAWJobs
This function sends the RAW printing request to the PrintNode service. The following parameters are in order of the function signature.
| Parameter | Type | Input | Comment |
| piPrinterID | Integer | PrintNode Printer ID | Specifies the PrintNode Printer ID where the RAW printing request is sent. |
| psPrintJobTitle | Text | Print job title | Specifies the print job title sent with the RAW printing request. This is the name that appears in the operating system’s print queue. |
| psRawText | Text | Raw print text | Specifies the string of commands to send as the RAW printing request. |
| piPrintJobQty | Integer | Print job quantity | Specifies the number of times the print job should be delivered to the print queue. For the RAW printing request, this is the total number of copies to print. |
Sample Extension
The following is a sample extension where an action is added to the IWX PrintNode Printer List page to trigger the RAW printing request. The action opens a worksheet page for the user to input the RAW printing commands to send with the request.
pageextension 59000 "IWX PNC Raw Print Test" extends "IWX PrintNode Printer List"
{
actions
{
addbefore(IWXRefreshPrintNodePrinters)
{
action(IWXTestRawPrinting)
{
ApplicationArea = All;
Caption = 'Test Raw Printing';
ToolTip = 'Test Raw printing for the PrintNode printer.';
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
PromotedOnly = true;
Image = Refresh;
trigger OnAction()
var
lcuPrintNodeAPIMgt: Codeunit "IWX PrintNode API Mgt.";
lsRawPrintText: Text;
begin
if (buildRawPrintText(lsRawPrintText)) then
if confirm('Print the following:' + '\' + lsRawPrintText) then
//Function "PrintRawJobs" parameters: Printer ID, Print Job Title, Raw Print Text, Print Job Quantity/Copies
lcuPrintNodeAPIMgt.PrintRawJobs(Rec.ID, 'Test RAW', lsRawPrintText, 1);
end;
}
}
}
local procedure buildRawPrintText(var lsRawPrintText: Text): Boolean
var
lpgIWXPNCRawPrintTextInput: page "IWX PNC Raw Print Text Input";
begin
// Function to open worksheet page for user to enter Raw printing text
lpgIWXPNCRawPrintTextInput.LookupMode := true;
if lpgIWXPNCRawPrintTextInput.RunModal() = Action::LookupOK then begin
lsRawPrintText := lpgIWXPNCRawPrintTextInput.getRawPrintText();
exit(true);
end;
exit(false);
end;
}
page 59000 "IWX PNC Raw Print Text Input"
{
AutoSplitKey = true;
Caption = 'Insight Works PrintNode Connnect Raw Printing Text Input';
Editable = true;
PageType = Worksheet;
SourceTable = "Name/Value Buffer";
SourceTableTemporary = true;
layout
{
area(content)
{
repeater(detail)
{
field(Value; Value)
{
ApplicationArea = All;
}
}
}
}
procedure getRawPrintText() rsRawPrintText: Text
var
crlf: Text[2];
begin
// Function to build the Raw printing text from the user input
crlf := '';
crlf[1] := 13;
crlf[2] := 10;
Rec.Reset();
if Rec.FindSet() then
repeat
if rsRawPrintText = '' then
rsRawPrintText := Rec.Value
else
rsRawPrintText += crlf + Rec.Value;
until Rec.Next() = 0;
end;
}
Still need help?
Ask other Business Central users in the Insight Works community, or send the details to the support team. Include the steps you took and any error message you saw.