Not getting "PDFXC3_StartDoc" from 64 Bit printer

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

Post Reply
pwechter
User
Posts: 3
Joined: Fri Jan 19, 2007 7:43 pm

Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by pwechter » Fri Jan 19, 2007 7:54 pm

My Visual C++ 6.0 application is not receiving the "PDFXC3_StartDoc" from the 64 Bit printer driver running on Windows Vista. This is working fine with 32 bit Vista.

Here is how I have it coded:

static nWM_PDFDOC_START3 =::RegisterWindowMessage("PDFXC3_StartDoc");
static nWM_PDFDOC_END3 = ::RegisterWindowMessage("PDFXC3_EndDoc");
static nWM_PDFDOC_DOCSAVED3 = ::RegisterWindowMessage("PDFXC3_DocSaved");
.
.
.
ON_REGISTERED_MESSAGE(nWM_PDFDOC_START3, OnPDFDocStart3)
ON_REGISTERED_MESSAGE(nWM_PDFDOC_END3, OnPDFDocEnd3)
ON_REGISTERED_MESSAGE(nWM_PDFDOC_DOCSAVED3, OnPDFDocSaved3)
.
.
.
LRESULT CMainFrame::OnPDFDocStart3(WPARAM wParam, LPARAM lParam)
{
HKEY hKey;
DWORD dRes;
DWORD desire;
CString sKeyname;
CString sKey;
CString app("None");

sKeyname.Format("Software\\Tracker Software\\PDF-XChange 3.0\\Drivers\\Control\\%.8lx", lParam);

dRes = RegCreateKeyEx(HKEY_CURRENT_USER, sKeyname, 0, NULL, 0, KEY_WRITE, NULL, &hKey, &desire);

if (dRes != ERROR_SUCCESS)
return 0;

RegSetValueEx(hKey, "Save.FullFileName", 0, REG_SZ, (BYTE*)(const char*)theApp.m_csPDFPathName,
theApp.m_csPDFPathName.GetLength() + 1);
RegSetValueEx(hKey, "Save.ShowSaveDialog", 0, REG_SZ, (LPBYTE)"No", 3);
RegSetValueEx(hKey, "Save.WhenExists", 0, REG_SZ, (LPBYTE)"Overwrite", 10);
RegSetValueEx(hKey, "Save.App.Run", 0, REG_SZ, (LPBYTE)(LPCSTR)app, app.GetLength() + 1);
RegSetValueEx(hKey, "Save.Type", 0, REG_SZ, (LPBYTE)(LPCSTR)"2", 3);
sKey = "MY KEY?????????????";
RegSetValueEx(hKey, "Reg.Key", 0, REG_SZ, (LPBYTE)(LPCSTR)sKey, sKey.GetLength() + 1);
sKey = "MY OTHER KEY?????????";
RegSetValueEx(hKey, "Reg.DevCode", 0, REG_SZ, (LPBYTE)(LPCSTR)sKey, sKey.GetLength() + 1);
RegCloseKey(hKey);

theApp.m_bPDFXCDocSaved = false;

return 1;
}



[/code]

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Sun Jan 21, 2007 12:24 pm

Hi,

On first looking at your code - it looks fine.

Could I ask you to please try the supplied C++ example and advise if this functions correctly - this will indicate if all has installed ok and if so the problem would appear to be in your application - in which case we would need a small example that fails to function - both source code and compiled project with any supporting files.

Please zip any files uploaded or emailed or they will be 'stripped' from your message.

Also please do not include your license keys in any sample.

thanks.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

pwechter
User
Posts: 3
Joined: Fri Jan 19, 2007 7:43 pm

"supplied C++ example"

Post by pwechter » Mon Jan 22, 2007 4:02 pm

Hi,

I don't see the supplied C++ example in your posting. Does this mean I should look for an example in the SDK?

Thanks,
Peter

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Mon Jan 22, 2007 6:49 pm

Hi,

Assuming you have the SDK download - you should have this already, however - please find all relevant API examples attached.

HTH
Attachments
CExamples.zip
(66.03 KiB) Downloaded 250 times
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

pwechter
User
Posts: 3
Joined: Fri Jan 19, 2007 7:43 pm

Sample app works okay but is different

Post by pwechter » Mon Jan 22, 2007 10:13 pm

Hi John,

The sample app works okay but uses ShellExecute to do its printing. We use the same drawing code that is used with any other printer driver. The funny thing is that the program is receiving the PDFXC3_DocSaved message but not the PDFXC3_DocStart or PDFXC3_DocEnd messages.

The program selects the printer driver, sets the receips key and then waits until the printing is complete to reset the receips key. Below is the code I use to get the printing going. Please note there is a message loop in it which waits for the PDF to be created. Do you have any samples that look like this because I don't think I made this part up myself?

// Create an PDFXChange Printer device
HGLOBAL hSaveDevNames;
HGLOBAL hSaveDevMode;
PRINTDLG PrintDlg;

theApp.GetPrinterDeviceDefaults(&PrintDlg);
hSaveDevNames = PrintDlg.hDevNames;
hSaveDevMode = PrintDlg.hDevMode;

HGLOBAL hDevNames = CreatePdfWriterDevNames();
HGLOBAL hDevMode = hSaveDevMode;

// Set current device to PDFXChange Printer
theApp.SelectPrinter(hDevNames, hDevMode, FALSE);

if (theApp.GetIsPDFXChangeInstalled())
{
// For PDF-XChange make sure that the file is not open in another process
CFile pdfFile;
CFileException pdfFileException;
if (theApp.FileExists(lpszPathName))
{
if (!pdfFile.Open(lpszPathName, CFile::shareExclusive, &pdfFileException))
{
CString csError;
csError.Format("%s %d","File could not be opened for error reason:", pdfFileException.m_cause);
AfxMessageBox(PRUIE_PDF_OUTPUT_FILE_BUSY, MB_OK,0);
bCannotOutput = true;
rv = FALSE;
}
else
pdfFile.Close();
}


if (!bCannotOutput && theApp.GetPDFXChangeVersion() == 30)
{
dRes = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Tracker Software\\PDF-XChange 3.0\\Drivers\\Control\\Receips",
0, NULL, 0, KEY_WRITE, NULL, &hKey, &desire);
if (hKey != NULL)
{
RegSetValueEx(hKey, "Presto", 0, REG_DWORD, (LPBYTE)&AfxGetMainWnd()->m_hWnd, sizeof(DWORD));
RegCloseKey(hKey);
}
}
}

// Create PDF file for document using PDF Writer
if (!bCannotOutput)
rv = pView->PrintPdfFile(this);

if (theApp.GetIsPDFXChangeInstalled() && theApp.GetPDFXChangeVersion() == 30)
while (!theApp.m_bPDFXCDocSaved)
{
MSG msg;
while (::PeekMessage(&msg, AfxGetMainWnd()->GetSafeHwnd(), 0, 0, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
continue;
}

if (theApp.GetIsPDFXChangeInstalled() && theApp.GetPDFXChangeVersion() == 30)
{
dRes = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Tracker Software\\PDF-XChange 3.0\\Drivers\\Control\\Receips",
0, NULL, 0, KEY_WRITE, NULL, &hKey, &desire);
if (hKey != NULL)
{
RegDeleteValue(hKey, "Presto");
RegCloseKey(hKey);
}
}

// Reselect current printer
theApp.SelectPrinter(hSaveDevNames, hSaveDevMode);

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Tue Jan 23, 2007 11:31 am

Hi Peter,

Looks like the problem is because your function pView->PrintPdfFile(this);
and message loop are present in the same thread.

Please move the message loop or printing function to another thread - please let me know if this resolves the problem for you.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

irik
User
Posts: 3
Joined: Wed May 28, 2008 3:21 pm

Re: Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by irik » Thu May 29, 2008 6:17 pm

Hi,
Have the some problem with using PDf-Xchange 3.0 driver in my C# application:
under 32 bit OS works fine but under 64 bit oS Vista wndproc does not catch the "ONDocStar" message
and does not create any pdf files.
What can be the problem?
Thanks,Irik Shafikov.

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by John - Tracker Supp » Thu May 29, 2008 9:39 pm

Please advise what build you are using and also the means used to communicate with the driver (ExtEscape, Messaging or ActiveX) - if the latter the only resolution may be to upgrade to Version 4.

Thanks
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

irik
User
Posts: 3
Joined: Wed May 28, 2008 3:21 pm

Re: Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by irik » Fri May 30, 2008 7:27 pm

Using the update release for v.3.0 and my app written in C# in VS2003.
It calles the print method of third party component written in VC++.
Wndproc is defined in C# application and trying to catch the registered "PDFXC3_StartDoc" message.
And the sample form the SDK works.

Ivan - Tracker Software
Site Admin
Posts: 3609
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by Ivan - Tracker Software » Tue Jun 03, 2008 6:26 am

All messages are sent by the driver with a timeout. If the message's recipient is busy (for example, it was into another message handler routine) this message will be not sent to this recipient.

HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

irik
User
Posts: 3
Joined: Wed May 28, 2008 3:21 pm

Re: Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by irik » Mon Jun 09, 2008 2:41 pm

Ivan,
any way to fix that problem without upgrating to v.4?

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: Not getting "PDFXC3_StartDoc" from 64 Bit printer

Post by John - Tracker Supp » Wed Jul 02, 2008 9:25 am

No - an upgrade is I am afraid the only resolution.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

Post Reply