Limited time promo

Hello World (network)


This help topic applies only to novaPDF. If you don't have it yet, you must download it first.

Download now Buy licenses
Mar 29, 2022
novaPDF 11.x
We strive to keep our help as accurate as possible. If you notice any inconsistencies or outdated info please let us know.
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())
    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"");