Using PrintJobHandler only from a certain place

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Using PrintJobHandler only from a certain place

Post by slivanov »

I'm writing a custom PrintJobHandler that interacts with the printing pipeline during Preprocessing stage. SoftPro hits my code anytime something is being printed from SoftPro Select:

Code: Select all

protected override PrintJobHandlerResult OnProcess(IPrintJob printJob) { ... }
I have to filter the printed context so it would print only from ProForm -> Order -> Documents tab. Can you help me to find the right parameters to identify that I'm printing from the right place?
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: Using PrintJobHandler only from a certain place

Post by yatin.t »

Try this in your print job handler code

Code: Select all

IWindowManager windowMgr = GetService<IWindowManager>();
if (windowMgr.ActiveWindow.Caption == "Documents")
{
    // The sending screen is the Order->Documents tab
}
:!: However, note that there is a risk (arguably an edge-case) that this code may break if the title of the tab is changed from "Documents" to say, "Los Documents" in a future release.
Yatin Tawde
Softpro
Software Engineer
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Re: Using PrintJobHandler only from a certain place

Post by slivanov »

In my case the Caption property has value: "Order 140-140200002"
But ActiveWindow.Situation = "Document".

Can I use Situation property instead?
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Re: Using PrintJobHandler only from a certain place

Post by slivanov »

I tried to print from other places and Situation property is always "Document". So I can't use it to identify the Documents tab. What are other options?
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: Using PrintJobHandler only from a certain place

Post by yatin.t »

Can you please describe what you're trying to achieve, what tab you are on, where you are printing/distributing the document from and so forth?
Yatin Tawde
Softpro
Software Engineer
slivanov
Posts: 10
Joined: Mon Jan 27, 2014 1:00 pm

Re: Using PrintJobHandler only from a certain place

Post by slivanov »

The forum doesn't want to attach my images. I sent them to your email.

When I do this:

Code: Select all

IWindowManager windowMgr = GetService<IWindowManager>();
The property windowMgr.ActiveWindow.Caption = "Order 140-140200002" and not "Documents" as you suggested. It takes the name of the main tab which is a name of an order in this case. That tab has inner tabs: Register, Documents, Checklist Tasks, etc. I assumed you knew all those tabs that's why I just wrote the path "ProForm -> Order -> Documents tab". It looks like you got my question right but your solution doesn't work for BOYLAN version. The main tab has inner tabs and I need to make sure that I'm printing from the right inner tab (in our case the tab names Documents).
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: Using PrintJobHandler only from a certain place

Post by yatin.t »

Thanks for sending me the screenshots.

Yes. The code I pasted works for Select 3.X and not for 2.6. Unfortunately, there's no straightforward solution to your problem as far 2.6 is concerned. I'll dig into it a bit more and let you know if I find anything.
Yatin Tawde
Softpro
Software Engineer
Post Reply