#include "ltdic.h"
L_INT LDicomPrintSCU::CreatePullPrintRequest(InstancesInfo, uInstancesCount, pParameters)
Requests the Print SCP to create a Pull Print Request SOP Instance.
A STOREDPRINTSTORAGEINSTANCEINFO structure pointer that specifies one or more of such structure. The count of the structures is determined by the parameter uInstancesCount. Each structure specifies information about one referenced Stored Print Storage SOP Instance. The function will return an error if the parameter InstancesInfo is set to NULL.
The count of the structures specified by the parameter InstancesInfo. The function will return an error if the parameter uInstancesCount is set to 0.
Pointer to a PULLPRINTREQUESTPARAMETERS structure that specifies the parameters of the Pull Print Request SOP Instance to be created. If this is set to NULL, the request will be sent to the Print SCP without specifying any parameters (Attributes).
Value | Meaning |
---|---|
0 | The Pull Print Request SOP Instance was created successfully. |
DICOM_ERROR_PRINTSCU_FAILURE_STATUS | The response of the Print SCP specifies a Failure status code; no Instance was created. |
DICOM_ERROR_PRINTSCU_CLASS_NOT_SUPPORTED | The Pull Stored Print Management Meta SOP Class is not supported on the Association, and hence the Pull Print Request SOP Class is not supported. |
> 0 | 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 LDicomPrintSCU::GetLastOperationStatus 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 LDicomPrintSCU::GetPullPrintRequestInstanceUID can then be used to obtain its SOP Instance UID. Also, the functions LDicomPrintSCU::PrintPullPrintRequestSession and LDicomPrintSCU::DeletePullPrintRequest 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.
Required DLLs and Libraries
Win32, x64
L_INT LDicomPrintSCU_CreatePullPrintRequestExample()
{
L_INT nRet;
LDicomPrintSCU PrintSCU;
//CPrintSCU PrintSCU;
L_TCHAR szMsg[32];
// Establish the Association
nRet = PrintSCU.Associate (TEXT("10.0.2.20"), 7104, 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;
PrintSCU.GetAssociateRejectInfo (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 = PrintSCU.GetDefaultPullPrintRequestParameters (&PullPrintReqParams,
sizeof(PULLPRINTREQUESTPARAMETERS));
if(nRet != DICOM_SUCCESS)
return nRet;
PullPrintReqParams.nNumberOfCopies = 1;
nRet = PrintSCU.CreatePullPrintRequest (&InstanceInfo, 1, &PullPrintReqParams);
if(nRet != DICOM_SUCCESS)
return nRet;
MessageBox(NULL, PrintSCU.GetPullPrintRequestInstanceUID (),
TEXT("Pull Print Request SOP Instance UID"), MB_OK);
// Print the session
nRet = PrintSCU.PrintPullPrintRequestSession ();
if(nRet != DICOM_SUCCESS)
return nRet;
// Display some info about the Print Job
if (PrintSCU.IsClassSupported (PRINTSCU_PRINT_JOB_SOP_CLASS))
{
//GetPrintJobInfo(PrintSCU, PrintSCU.GetPrintJobInstanceUID ());
}
// Ask the Print SCP to delete the Pull Print Request SOP Instance
nRet = PrintSCU.DeletePullPrintRequest ();
if(nRet != DICOM_SUCCESS)
return nRet;
// Release the Association and close the connection
nRet = PrintSCU.Release ();
if(nRet != DICOM_SUCCESS)
return nRet;
return DICOM_SUCCESS;
}