Citrix vs instance of PDF-Xchange printer

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
Maciej Tokarski
User
Posts: 23
Joined: Mon Feb 09, 2009 8:52 am

Citrix vs instance of PDF-Xchange printer

Post by Maciej Tokarski »

Hello,
For a year or two we've been using your PDF-Printer in our product, and we are very pleased with it. We have to maintain pretty an old solution, which includes a kind of a "native" print spooler. The spooler gets EMF files from instances of our main app and uses PlayMetafiles function on the created PDF-XChange printer. Old C-code, but still working and reliable.
The topology is: n-applications -> 1 spooler <-> 1 PDF-Xchange printer. The spooler first calls "RemoveOrphanPrinters" (to avoid any printer remaining e.g.: after the spooler's crash) and afterwards creates an instance of the PDF printer, with a predefined name (let's say "Our_printer"). This step is important, as our application refers to printers by their names at many places. So it is very important, that any orphan printers get removed, in order to always work with "Our_printer", not with "Our_printer (1)".
The last instance of out main app closes the spooler process at its own shutdown, releasing "Our_printer".

It works fine, but recently there's been a need to launch our app in the Citrix environment. The topology is different then, because instances of main app don't know about each other, therefore there's many spoolers running in parallel. The thing is, no matter how many spoolers are running, only one instance of "Our_printer" gets created and the first spooler to shut down also releases "Our_printer".

I ran two experiments:
1) created a version of the spooler without releasing the printer object, which means I commented out the call to the following function:

HRESULT MyPXCHandler::Finish()
{
if (m_pPrinter != NULL)
{
DispEventUnadvise(m_pPrinter);
m_pPrinter.Release();
}
if (m_pFactory != NULL)
{
m_pFactory.Release();
}
return S_OK;
}

It did no good. The printer still disappeared whenever any of the spooler instances shut down.

2) I created a version, without "RemoveOrphanPrinters" function.

Then in fact each successive spooler creates its own instance of "Our_printer", with a successive suffix number ("Our_printer (1)","Our_printer (2)" and so on...)

I am a bit confused. Could you please explain me the behaviour under Citrix? Would it be doable that all instances of the spooler can use the same printer instance, and get registered for its events? Or is it simply impossible in the Citrix environment? Our processes work in the scope of one Citrix session and particaular sessions doesn't know of each other - is it possible to create a PDF-Xchange printer for the scope of a session only, not for the whole system?

Would be very grateful for any hints.
Regards,
Maciej Tokarski
Maciej Tokarski
User
Posts: 23
Joined: Mon Feb 09, 2009 8:52 am

Re: Citrix vs instance of PDF-Xchange printer

Post by Maciej Tokarski »

I did some more experimenting; the conclusion is: RemoveOrphanPrinters acts differently under Citrix that under pure Windows Server TS solution. Under Citrix it removes a printer which belongs to other active session! In Windows TS environment it doesn't do that.
Why is it so? Can you give me a hint, if there is some system/session setting which changes this behaviour? The expected behaviour is that in Windows TS.

Regards,
Maciej
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17941
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Citrix vs instance of PDF-Xchange printer

Post by Tracker Supp-Stefan »

Hello Maciej,

I myself do not have any experience with Citrix environments, but will ask the dev guys here if they have any helpful advice to give, although it might be beyond our control to fix this behaviour.

Best,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Citrix vs instance of PDF-Xchange printer

Post by Ivan - Tracker Software »

RemoveOrphanPrinters function enumerates all printers in the system and removes those created by the PDF-XChange SDK (special mark in printer's data) and the name starts with the string passed as the function's argument. To remove printers it uses the Windows API's function DeletePrinter.

Regretably don't know where (if any) there are differences in TS and Citrix with this function ...
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.
Post Reply