Doc Publishing in 4.5.1

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
JohnS
Posts: 4
Joined: Thu Apr 28, 2016 2:34 pm

Doc Publishing in 4.5.1

Post by JohnS »

After upgrading to 4.1, our document publishing print handler has stopped working. We have a C# module, shown below, that in turn calls a vb module. The C# code is shown below:

protected override PrintJobHandlerResult OnProcess(IPrintJob printJob)
{
try
{
ERprjSendPrintJob2Svo.ERclsSendPrintJob2Svo send2Svo = new ERprjSendPrintJob2Svo.ERclsSendPrintJob2Svo();
MemoryStream destination = new MemoryStream();
var sps = ServiceContext.GetService<SelectServer>();
var username = sps.AuthenticatedUserName;

if (printJob.Properties["MergeKind"].ToString() == "All")
{
// merge the documents yourself
IPdfToolsProvider provider = GetService<IPdfToolsProvider>();
Stream merged = provider.Merge(printJob.OriginalItems
.Select(item => new MemoryStream((byte[])item.Properties["Binary"]))
.ToArray());
merged.CopyTo(destination);
}

send2Svo.ProcessPrintJob(ref printJob, username, destination.ToArray());
destination.Close();
destination.Dispose();

}
catch (Exception ex)
{
// Write this error to the Windows event Application log
EventLog.WriteEntry(sourceName, ex.Message, EventLogEntryType.Error );

}
if (debugLog == "1")
{
// Write this error to the Windows event Application log
EventLog.WriteEntry(sourceName, "end print", EventLogEntryType.Information);
}


// Proceed to next handler
return PrintJobHandlerResult.Continue;

}


A snippet of the vb code follows:

Public Class ERclsSendPrintJob2Svo
Public Sub ProcessPrintJob(ByRef printJob As IPrintJob, ByVal userName As String, ByVal bytBinaryDoc As Byte())
.
.
.
For Each objItem In printJob.OriginalItems
strFileName = objItem.Properties("Document").Title

Call SendTarget2SvoDocs( _
strFileName, _
strFullPathAndName, _
strSoftProUser, _
strSoftProOffice, _
strOrderID, _
frmQuickPost.gintParentID, _
frmQuickPost.gintDocumentType_ID, _
frmQuickPost.gstrComment, _
objItem.Properties("Binary"))

Next


Example 1:
I select multiple documents to publish, choose to merge them, and break on the 'if' statement that checks 'MergeKind'. In the debugger I can see the following:
JohnS
Posts: 4
Joined: Thu Apr 28, 2016 2:34 pm

Re: Doc Publishing in 4.5.1

Post by JohnS »

Please ignore this one, the post was incomplete. There is a second, complete post with the same subject.
Post Reply