#include "ltdic.h"
L_LTDIC_API L_INT L_DicomPrintSCUCreatePullPrintRequest(hPrintSCU, InstancesInfo, uInstancesCount, pParameters)
A handle to Dicom Print SCU.
Referenced Stored Print.
Count of Stored Print Instances.
Pull Print Request parameters.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Only one Pull Print Request SOP Instance can be supported on the Association at any time.
The function will not return until it receives the response of the Print SCP, or an error occurs. The function L_DicomPrintSCUGetLastOperationStatus can be used to obtain the status code specified in the response of the Print SCP. When the return value of the function CreatePullPrintRequest is 0, then the Pull Print Request SOP Instance was created successfully, with either a Success or Warning status code in the response of the Print SCP.
Having the Instance created, the function L_DicomPrintSCUGetPullPrintRequestInstanceUID can then be used to obtain its SOP Instance UID. Also, the functions L_DicomPrintSCUPrintPullPrintRequestSession and L_DicomPrintSCUDeletePullPrintRequest can be used to print the session and to delete the Instance, respectively.
At least one Stored Print Storage SOP Instance must be specified to be referenced. The information about each such Instance is specified using a STOREDPRINTSTORAGEINSTANCEINFO structure. Except for the member pszPatientID, if any string member of the structure is set to NULL or if the member specifies an empty string, the function will return an error.
The parameter pParameters points to a PULLPRINTREQUESTPARAMETERS structure that specifies the parameters to be used when creating the Pull Print Request SOP Instance. In this structure, if a string member is NULL, then the corresponding Attribute will not be included in the request to the Print SCP. Similarly, if a numeric member (that specifies an Attribute) is negative, the corresponding Attribute will not be included in the request. If pParameters is set to NULL, then the request will be sent without specifying any parameters.
Win32, x64, Linux.
L_INT DicomPrintSCUCreatePullPrintRequestExample()
{
L_INT nRet;
HDICOMPRINTSCU hPrintSCU;
hPrintSCU = L_DicomPrintSCUCreate(NULL);
L_TCHAR szMsg[32];
// Establish the Association
nRet = L_DicomPrintSCUAssociate (hPrintSCU, TEXT("10.0.2.20"), 7104, TEXT("PrintSCP"), 2704,
TEXT("PrintSCP"), TEXT("PrintSCU"),
PRINTSCU_PULL_STORED_PM_META_SOP_CLASS |
PRINTSCU_PRINT_JOB_SOP_CLASS |
PRINTSCU_PRINTER_CONFIGURATION_RETRIEVAL_SOP_CLASS);
if (nRet == DICOM_ERROR_PRINTSCU_ASSOCIATE_RQ_REJECTED)
{
L_UCHAR nSource, nReason;
L_DicomPrintSCUGetAssociateRejectInfo (hPrintSCU,NULL, &nSource, &nReason);
wsprintf(szMsg, TEXT("Source = %i, Reason = %i"), nSource, nReason);
MessageBox(NULL, szMsg, TEXT("Association Request was Rejected"), MB_OK);
return nRet;
}
else if (nRet != DICOM_SUCCESS)
{
wsprintf(szMsg, TEXT("Error code: %i"), nRet);
MessageBox(NULL, szMsg, TEXT("Failed to Establish the Association"), MB_OK);
return nRet;
}
// Display some printer info
//GetPrinterInfo(PrintSCU);
// Display some printer configuration info
//GetPrinterConfigInfo(PrintSCU);
// A referenced Stored Print Storage SOP Instance
STOREDPRINTSTORAGEINSTANCEINFO InstanceInfo;
InstanceInfo.uStructSize = sizeof(STOREDPRINTSTORAGEINSTANCEINFO);
InstanceInfo.pszRetrieveAETitle = TEXT("SomeAE");
InstanceInfo.pszReferencedSOPInstanceUID = TEXT("1.2.840.114257.254.7638.6787");
InstanceInfo.pszStudyInstanceUID = TEXT("1.2.840.114257.945.5676.5674");
InstanceInfo.pszSeriesInstanceUID = TEXT("1.2.840.114257.23.2343.3489");
InstanceInfo.pszPatientID = TEXT("SomeID");
PULLPRINTREQUESTPARAMETERS PullPrintReqParams;
// Ask the Print SCP to create a Pull Print Request SOP Instance
nRet = L_DicomPrintSCUGetDefaultPullPrintRequestParameters (hPrintSCU, &PullPrintReqParams,
sizeof(PULLPRINTREQUESTPARAMETERS));
if(nRet != DICOM_SUCCESS)
return nRet;
PullPrintReqParams.nNumberOfCopies = 1;
nRet = L_DicomPrintSCUCreatePullPrintRequest (hPrintSCU, &InstanceInfo, 1, &PullPrintReqParams);
if(nRet != DICOM_SUCCESS)
return nRet;
MessageBox(NULL, L_DicomPrintSCUGetPullPrintRequestInstanceUID (hPrintSCU),
TEXT("Pull Print Request SOP Instance UID"), MB_OK);
// Print the session
nRet = L_DicomPrintSCUPrintPullPrintRequestSession (hPrintSCU);
if(nRet != DICOM_SUCCESS)
return nRet;
// Display some info about the Print Job
if (L_DicomPrintSCUIsClassSupported (hPrintSCU, PRINTSCU_PRINT_JOB_SOP_CLASS))
{
//GetPrintJobInfo(PrintSCU, L_DicomPrintSCUGetPrintJobInstanceUID ());
}
// Ask the Print SCP to delete the Pull Print Request SOP Instance
nRet = L_DicomPrintSCUDeletePullPrintRequest (hPrintSCU);
if(nRet != DICOM_SUCCESS)
return nRet;
// Release the Association and close the connection
nRet = L_DicomPrintSCURelease (hPrintSCU);
if(nRet != DICOM_SUCCESS)
return nRet;
return DICOM_SUCCESS;
}