fralx / LimeReport

Report generator for Qt Framework
http://limereport.ru/
Other
401 stars 152 forks source link

The picture color is change #409

Open liufeijin opened 1 year ago

liufeijin commented 1 year ago

Hi fralx I found that LimeReport preview the png in report is ok. but print to PDF in LimeReport Menu the color will be change in got pdf file QQ截图20220728110216 P12 TEST.zip

LimeReport::ReportEngine Report2 ; QString FileFolder; FileFolder = QFileDialog::getExistingDirectory( 0, "选择要保存PDF的目录",QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); QFile sd; //QFileDevice::WriteUser if(!FileFolder.trimmed().isEmpty()){ sd.setFileName(FileFolder+"/tt.PDF"); if(sd.exists()){ sd.remove(); } }else{ TiShi.information(0, tr("选择要保存PDF证书的目录"),tr("要保存PDF证书的目录为空,请选择一个要保存的地方"), QMessageBox::Cancel); } QImage P12; // P1保存压缩文件 h.zip

QFile PicFile; // P1 暂时给老系统 P的压缩包文件了。 以后不用老系统 可以用回来P1字段 PicFile.setFileName(FileFolder+"/P12.png"); qDebug()<<FileFolder+"/P12.png"; if(PicFile.exists()){ P12.load(FileFolder+"/P12.png","png"); } Report2.loadFromFile(FileFolder+"/TEST.lrxml"); Report2.dataManager()->setReportVariable("P12",P12);

Report2.previewReport();

 Report2.printToPDF(sd.fileName());