Page 1 of 1

Upgrading from V3 to V4

Posted: Thu Aug 11, 2011 10:08 pm
by gfindlay
I'm contemplating upgrading from V3 to V4.

I can't find a good document on how to go about doing this. We simply have our C++ code set the default printer to be the PDF-XChange 3.0 driver, set the key to hide the watermarks, and let the normal flow of printing create the PDF file.

In V3, we used code like this:

static DWORD m_WM_PDFDOC_START = ::RegisterWindowMessage(_T("PDFXC3_StartDoc"));

At the start of each new document:
LRESULT CMainFrame::OnPDFDocStart(WPARAM wParam, LPARAM lParam)
{
if (!m_pApp->m_bPDFHook)
return 0;
m_pApp->m_bPDFHook = FALSE;

DWORD dRes, dDesired;
CString sKeyname;
CString sKey(_T("[our key]"));
CString sDevCode(_T("[our coode]"));
CString sCreator;
sCreator.LoadString(IDS_WPPRINTERNAME);

sKeyname.Format(_T("Software\\Tracker Software\\PDF-XChange 3.0\\Drivers\\Control\\%.8lx"), lParam);
HKEY hKey;
dRes = RegCreateKeyEx(HKEY_CURRENT_USER, sKeyname, 0, NULL, 0, KEY_WRITE, NULL, &hKey, &dDesired);
if (dRes != ERROR_SUCCESS)
return 0;

CString sApp(_T("Default"));
CString sTitle(_T("A Title"));
CString sAuthor;
sAuthor = _T("Author");
CString s(_T("Name"));
RegSetValueEx(hKey, _T("Reg.Key"), 0, REG_SZ, (BYTE *)(LPCTSTR )sKey, (sKey.GetLength() + 1) * sizeof(TCHAR));
RegSetValueEx(hKey, _T("Reg.DevCode"), 0, REG_SZ, (BYTE *)(LPCTSTR )sDevCode, (sDevCode.GetLength() + 1) * sizeof(TCHAR));
RegSetValueEx(hKey, _T("Info.Title"), 0, REG_SZ, (BYTE *)(LPCTSTR )sTitle, (sTitle.GetLength() + 1) * sizeof(TCHAR));
RegSetValueEx(hKey, _T("Info.Author"), 0, REG_SZ, (BYTE *)(LPCTSTR )sAuthor, (sAuthor.GetLength() + 1) * sizeof(TCHAR));
RegSetValueEx(hKey, _T("Info.Creator"), 0, REG_SZ, (BYTE *)(LPCTSTR )sCreator, (sCreator.GetLength() + 1) * sizeof(TCHAR));
// RegSetValueEx(hKey, _T("RunApp"), 0, REG_SZ, (BYTE*)(LPCTSTR )sApp, (sApp.GetLength() + 1) * sizeof(TCHAR));
RegCloseKey(hKey);

return 1;
}


Once the document was complete, PDF Exchange 3.0 asked the user for a filename, then saved it.

What do we do to accomplish the same in V4?

Re: Upgrading from V3 to V4

Posted: Fri Aug 12, 2011 9:38 am
by Tracker Supp-Stefan
Hello gfindlay,

Attached is the main dialogue source from the C Drivers API example application.
Please check the PreparePrinter() and also make sure to check "3.1.2.14 Section Save" in the Drivers API manual file, for an explanation of the different Save options and how to make the drivers prompt for a file name.

Best,
Stefan