Performing Pull Stored Print Management Example for VB.NET

Private Sub PerformPullStoredPM()
   Dim objPrintSCU As New LTDICPRNSCULib.LEADDicomPrintSCU
   ' Establish the Association
   Dim nRet As Short
   nRet = objPrintSCU.Associate("10.0.2.20", 7104, "PrintSCP", "PrintSCU", LTDICPRNSCULib.DicomClassEnum.PRNSCU_PULL_STORED_PM_META_SOP_CLASS + LTDICPRNSCULib.DicomClassEnum.PRNSCU_PRINT_JOB_SOP_CLASS + LTDICPRNSCULib.DicomClassEnum.PRNSCU_PRINTER_CONFIGURATION_RETRIEVAL_SOP_CLASS)
   If nRet = LTDicomKernelLib.DicomErrorCodes.DICOM_ERROR_PRINTSCU_ASSOCIATE_RQ_REJECTED Then
      MessageBox.Show("Source = " & objPrintSCU.AssociateRejectSource & ", " & "Reason = " & objPrintSCU.AssociateRejectReason, "Association Request was Rejected")
      Exit Sub
   ElseIf nRet <> LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS Then
      MessageBox.Show("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 = LTDICPRNSCULib.PullPrintRequestParameterEnum.PPR_NUMBER_OF_COPIES
      .NumberOfCopies = 1
      .Create()
      MessageBox.Show(.SOPInstanceUID, "Pull Print Request SOP Instance UID")
      ' Print the session
      .PrintSession()
      ' Display some info about the Print Job
      If .MainObject.IsClassSupported(LTDICPRNSCULib.DicomClassEnum.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