Performing Pull Stored Print Management Example for Visual Basic
Private Sub PerformPullStoredPM()
Dim objPrintSCU As New LEADDicomPrintSCU
'Set objPrintSCU = New LEADDicomPrintSCU
' Establish the Association
Dim nRet As Integer
nRet = objPrintSCU.Associate("10.0.2.20", 7104, "PrintSCP", "PrintSCU", _
PRNSCU_PULL_STORED_PM_META_SOP_CLASS + _
PRNSCU_PRINT_JOB_SOP_CLASS + _
PRNSCU_PRINTER_CONFIGURATION_RETRIEVAL_SOP_CLASS)
If nRet = DICOM_ERROR_PRINTSCU_ASSOCIATE_RQ_REJECTED Then
MsgBox "Source = " & objPrintSCU.AssociateRejectSource & ", " & _
"Reason = " & objPrintSCU.AssociateRejectReason, , _
"Association Request was Rejected"
Exit Sub
ElseIf nRet <> DICOM_SUCCESS Then
MsgBox "Error code: " & nRet, , "Failed to Establish the Association"
Exit Sub
End If
' Display some printer info
'GetPrinterInfo objPrintSCU
' Display some printer configuration info
'GetPrinterConfigInfo objPrintSCU
With objPrintSCU.PullPrintRequest
' A referenced Stored Print Storage SOP Instance
.RemoveAllStoredPrintItems
.AddStoredPrintItem "SomeAE", _
"1.2.840.114257.254.7638.6787", _
"1.2.840.114257.945.5676.5674", _
"1.2.840.114257.23.2343.3489", _
"SomeID"
' Ask the Print SCP to create a Pull Print Request SOP Instance
.IncludedParameters = PPR_NUMBER_OF_COPIES
.NumberOfCopies = 1
.Create
MsgBox .SOPInstanceUID, , "Pull Print Request SOP Instance UID"
' Print the session
.PrintSession
' Display some info about the Print Job
If .MainObject.IsClassSupported (PRNSCU_PRINT_JOB_SOP_CLASS) Then
'GetPrintJobInfo objPrintSCU, .PrintJobSOPInstanceUID
End If
' Ask the Print SCP to delete the Pull Print Request SOP Instance
.Delete
End With
' Release the Association and close the connection
objPrintSCU.ReleaseAssociation
End Sub