Hello World (network) sample is similar with Hello World sample but it can be used from network and print to novaPDF installed on a different computer. The sample requests the shared printer name in a dialog as "\computer name\printer name" (for example if novaPDF SDK is installed on WS1, then you should enter "\WS1\novaPDF SDK"). See Network use topic for more details on how to use novaPDF on network.
Source Code snippets (in addition to Hello World source code)
{
//...
//initialize COM
hr = CoInitialize(NULL);
if (FAILED (hr))
{
MessageBoxW(NULL, L"Failed to initialize COM", L"novaPDF", MB_OK);
return hr;
}
//create one NovaPdfOptions instance
INovaPdfOptions *pNova = 0;
hr = CoCreateInstance(__uuidof(NovaPdfOptions11), NULL, CLSCTX_INPROC_SERVER, __uuidof(INovaPdfOptions11), (LPVOID*) &pNova);
if (FAILED(hr))
{
MessageBoxW(NULL, L"Failed to create novaPDF COM object", L"novaPDF", MB_OK);
return hr;
}
DWORD dwSize = 256;
WCHAR strWorkStation[256];
//find out computer name
GetComputerNameW(strWorkStation, &dwSize);
PrinterNameDlg dlg;
//construct printer name as "\\computer name\printer name"
dlg.m_strPrinterName.Format(L"\\\\%s\\%s", strWorkStation, PRINTER_NAME);
//get printer name from user
if (IDCANCEL == dlg.DoModal())
{
pNova->Release();
CoUninitialize();
return hr;
}
CString strPrinterName = dlg.m_strPrinterName;
// initialize the NovaPdfOptions object to use with a printer licensed for SDK
hr = pNova->Initialize((LPCWSTR)strPrinterName, L"");
//...
}