Retrieving PDF from XML - Transaction Point

Discussions concerning general integration topics.

Moderator: Phil Barton

Mark McKenna

Re: Retrieving PDF from XML - Transaction Point

Post by Mark McKenna »

Access to the various SPAdmin modules is protected by permission. Since you can access the SPAdmin tab, you at least have permission to access that module. There is also a permission that governs the ability to add/remove/modify Profile information. You should verify that you have the proper access rights to edit Profile settings, although it would seem strange to have access to SPAdmin, in general, but not access to the functionality contained therein. Still, its worth verifying. Also be sure that you are selecting the appropriate profile to view/modify from the tree on the left-hand side (for example, if you have the "Profiles" folder highlighted, the tabs would be grayed out).
Mark McKenna

Re: Retrieving PDF from XML - Transaction Point

Post by Mark McKenna »

Your package class needs an attribute that associates the handler type with the package. Like this:

Code: Select all

[ProvidePrintDispatchHandler( typeof( PublishToWeb ), PipelineStage.Processing, 25 )]
Check out my post from 12/29 for details on using that attribute.
Shevy
Posts: 48
Joined: Tue Dec 23, 2008 12:21 pm

Re: Retrieving PDF from XML - Transaction Point

Post by Shevy »

Thanks, I got it to work. Now I even got the publish button active. My next question is how do I ONLY run my code when I click on publish and not the default code. Also it seems that it is going into my code on any of the print buttons not only publish and I have an if statement in the code.
thanks.
Mark McKenna

Re: Retrieving PDF from XML - Transaction Point

Post by Mark McKenna »

Every dispatch handler that is registered will execute in sequence until a handler decides to halt the pipeline by returning true from its OnHandleDispatched method. Therefore, its the handler's responsibility to determine whether or not to actually "do anything" with the job it was handed, or to just ignore it. That's where the "Targets" property on the print job comes into play, as you noted a few posts back. In your case, if "Publish" is not one of the assigned targets, just ignore the print job altogether by simply returning false. Is that the "if statement" you're referring to? Anyway, it would look like this:

Code: Select all

protected override bool OnHandleDispatched( IPrintJob printJob )
{
    // look for the proper target
    if ( ( printJob.Properties[PrintJobProperty.Targets] as List<String> ).Contains( Enum.GetName( typeof( PrintJobTarget ), PrintJobTarget.Publish ) ) )
    {
        // do your stuff - maybe return true here if there's some sort of error
    }

    // either way, keep the pipeline going
    return false;
}
As for disabling our default Publish handler, you have 2 options:
1. (Recommended) Run your Publish handler before our Publish handler and return true if it was a Publish job. You won't get any downstream handlers but the only post-processing one that runs anyway is the "auditor" that provides document history for the order. Its quite likely that you wouldn't want that to execute anyway for your web postings.
2. Remove our handler altogether. The handlers are registered in the Registry under key HKEY_LOCAL_MACHINE\SOFTWARE\SoftPro\Select\[version]\Configuration\Printing\DispatchHandlers. The only way to disable it currently is to remove the appropriate key (which corresponds to the fixed system guid of the handler type)... 6A32F0E6-65DE-4a89-B948-7BB40FEEAA55, in this case. I believe the default handlers are currently being reinstalled on subsequent Select installs, though, so that's something to be aware of.
Shevy
Posts: 48
Joined: Tue Dec 23, 2008 12:21 pm

Re: Retrieving PDF from XML - Transaction Point

Post by Shevy »

I put in "return false" after the if statement - for any other print job, now it is working that it is only running my code from the publish button. Thanks.

My next question is I would like to run my code, inorder to run my code I need to get information about the pdf (what firmfile it is connected to.) How do I get that information?

Thank you.
Mark McKenna

Re: Retrieving PDF from XML - Transaction Point

Post by Mark McKenna »

If you query the keys for the Properties that are attached to either the IPrintJob or IPrintJobItem objects you will "discover" all the extensible metadata, if you will, that is attached to each. On the IPrintJob specifically, there is an "Order" key that provides you with an IOrder reference you can use to gather that information. Like this:

Code: Select all

protected override bool OnHandleDispatched( IPrintJob printJob )
{
	SoftPro.OrderTracking.Client.IOrder order = printJob.Properties["Order"] as SoftPro.OrderTracking.Client.IOrder;
	// I think this is what you're referring to as "firmfile"...
	string ordernumber = order.Number;

	return false;
}
Shevy
Posts: 48
Joined: Tue Dec 23, 2008 12:21 pm

Re: Retrieving PDF from XML - Transaction Point

Post by Shevy »

Thanks that is what I need. However when I try to implement that code I get an error:
type Softpro.Ordertracking.client.Iorder is not defined. I try to bring it in with "imports" (same as using, in c#) and when I type softpro. there is no "Ordertracking". The only thing that drops down is .select and .shell. How do I get the OrderTracking dll?
Thanks.
Mark McKenna

Re: Retrieving PDF from XML - Transaction Point

Post by Mark McKenna »

The IOrder interface is exposed by the SoftPro.OrderTracking.Client library so you probably just need to add the appropriate reference to your project.
Shevy
Posts: 48
Joined: Tue Dec 23, 2008 12:21 pm

Re: Retrieving PDF from XML - Transaction Point

Post by Shevy »

Thank you. I understood that but at first I was looking for the class under the SDK folder. I ended up finding it under "select" folder.
My next question is I would like to get the description of the document being printed, how do I get that? I looked under the documentation for the IprintJobItem - there is a properties property which I would assume I need to use, but what are all the properties? In my previous code which I got from you I used the "FileLocation" property. Are there any other properties for me to access?
Thanks.
Mark McKenna

Re: Retrieving PDF from XML - Transaction Point

Post by Mark McKenna »

Those "Properties" properties on the IPrintJob and IPrintJobItem objects are nothing more than string->object hash sets so you can investigate all that is available to you by looking at the key names (note that a few entries are for our internal use and will expose types for which you do not have access). In your particular case, I think you're looking for the IPrintJobItem's DocReportName property (the name of the document or report).
Post Reply