Performing Pull Stored Print Management Example for C#
//Performing Pull Stored Print Management Example
private void PerformPullStoredPM()
{
LTDICPRNSCULib.LEADDicomPrintSCU objPrintSCU = new LTDICPRNSCULib.LEADDicomPrintSCU();
// Establish the Association
short nRet = 0;
nRet = objPrintSCU.Associate("10.0.2.20",
7104, "PrintSCP", "PrintSCU", (LTDICPRNSCULib.DicomClassEnum)((int)LTDICPRNSCULib.DicomClassEnum.PRNSCU_PULL_STORED_PM_META_SOP_CLASS
+ (int)LTDICPRNSCULib.DicomClassEnum.PRNSCU_PRINT_JOB_SOP_CLASS + (int)LTDICPRNSCULib.DicomClassEnum.PRNSCU_PRINTER_CONFIGURATION_RETRIEVAL_SOP_CLASS));
if (nRet == (short)LTDicomKernelLib.DicomErrorCodes.DICOM_ERROR_PRINTSCU_ASSOCIATE_RQ_REJECTED)
{
MessageBox.Show("Source = "
+ objPrintSCU.AssociateRejectSource
+ ", " + "Reason = " + objPrintSCU.AssociateRejectReason,
"Association Request was Rejected");
return;
}
else if (nRet != (short)LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS)
{
MessageBox.Show("Error
code: " + nRet, "Failed to Establish the Association");
return;
}
// Display some printer info
//GetPrinterInfo objPrintSCU
// Display some printer configuration
info
//GetPrinterConfigInfo objPrintSCU
// A referenced Stored Print Storage
SOP Instance;
objPrintSCU.PullPrintRequest.RemoveAllStoredPrintItems();
objPrintSCU.PullPrintRequest.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
objPrintSCU.PullPrintRequest.IncludedParameters
= LTDICPRNSCULib.PullPrintRequestParameterEnum.PPR_NUMBER_OF_COPIES;
objPrintSCU.PullPrintRequest.NumberOfCopies
= 1;
objPrintSCU.PullPrintRequest.Create();
MessageBox.Show(objPrintSCU.PullPrintRequest.SOPInstanceUID,
"Pull Print Request SOP Instance UID");
// Print the session
objPrintSCU.PullPrintRequest.PrintSession();
// Display some info about the Print
Job
if (objPrintSCU.PullPrintRequest.MainObject.IsClassSupported(LTDICPRNSCULib.DicomClassEnum.PRNSCU_PRINT_JOB_SOP_CLASS))
{
//GetPrintJobInfo
objPrintSCU, .PrintJobSOPInstanceUID
}
// Ask the Print SCP to delete the
Pull Print Request SOP Instance
objPrintSCU.PullPrintRequest.Delete();
// Release the Association and close
the connection
objPrintSCU.ReleaseAssociation();
}