这是我根据上面步骤参考DCMTK 里面dcmprscu工程写了段代码
opt_ownerID="mypringd";
opt_mediumtype="CS";//printer medium type identifier, may be empty. VR=CS, VM=1
opt_destination="CS";//printer film destination identifier, may be empty. VR=CS, VM=1
opt_sessionlabel="CS";//printer film session label, may be empty. VR=LO, VM=1
opt_priority="MED"; // printer print priority, may be empty. VR=CS, VM=1, * enumerated values: HIGH, MED, LOW
targetHostname ="127.0.0.1";
targetDescription ="first printer test";
targetAETitle ="DataAEtitle";
targetPort =104;
targetMaxPDU =32768;
targetImplicitOnly =OFTrue;
targetDisableNewVRs =OFFalse;
targetSupportsPLUT =OFTrue;
targetSupportsAnnotation =OFTrue;
targetSupports12bit = OFTrue;
targetPLUTinFilmSession =OFTrue;
targetRequiresMatchingLUT =OFTrue;
deleteTerminateJobs = OFFalse;
useTLS = OFFalse;
// we have successfully read the Stored Print, now open connection to printer
OFString NetWorkAETitle("app first printe");
DVPSPrintMessageHandler printHandler;
result = printHandler.negotiateAssociation(tlayer,
NetWorkAETitle.c_str(),//
targetAETitle,//
targetHostname,
targetPort,
targetMaxPDU,//32768
targetSupportsPLUT, //true
targetSupportsAnnotation, //false
targetImplicitOnly);//false
if(result!=EC_Normal)
{
return false;
}
DVPSStoredPrint storePrint(2000,10,NULL);
result = storePrint.printSCUgetPrinterInstance(printHandler);
if (EC_Normal != result)
{
*logstream << "spooler: printer communication failed, unable to request printer settings." << endl;
}
if (EC_Normal==result)
{
result = storePrint.printSCUpreparePresentationLUT(printHandler,
targetRequiresMatchingLUT,
targetPreferSCPLUTRendering,
targetSupports12bit);
if (EC_Normal != result)
*logstream << "unable to create presentation LUT." << endl;
}
if (EC_Normal==result)
{
result = storePrint.printSCUcreateBasicFilmSession(printHandler, *dset,OFTrue);
if (EC_Normal != result)
*logstream << " unable to create basic film session." << endl;
}
if (EC_Normal==result)
{
targetPLUTinFilmSession=OFFalse;
result = storePrint.printSCUcreateBasicFilmBox(printHandler, targetPLUTinFilmSession);//失败了。??????????
if (EC_Normal != result)
*logstream << "unable to create basic film box." << endl;
}
但storePrint.printSCUcreateBasicFilmBox(printHandler, targetPLUTinFilmSession);返回失败了。
是不是我调用顺序错了? |