Home General

Quality of big BMP exported to PDF from RB 12.05 build2 is poor

edited September 2011 in General
Hi,

I have a question regarding printing BMP to PDF via RB. I've seen the
discussion with Glenn and Nico regarding similar issue but here I do
not use any extra stuff. What I am doing is to create an image on
hidden form that produces a bitmap of 1700x2400 pixels which is then
loaded into TppImage. Printing this report directly to printers is
excellent, printing to CutePDF also but if I choose print to PDF in
printer dialog, then produced PDF has image far far from other prints.
The bitmap is bad, had big pixels visible, actually the quality is so
bad that one can't define what's on that bitmap.
Any ideas? I use Delphi XE with ReportBuilder 12.05 build2. Nico, if
You need comparison PDFs and original bitmap, let me know.

Code snippets (if it helps):

procedure TfrmPP.Print;

function LoadReport(var AReportName : String): boolean;
begin
AReportName :=
IncludeTrailingPathDelimiter(glCommon.ProgramData.MapaReport);
if Assigned(glCommon.Logo) then
AReportName := AReportName + 'PrintS.rtm'
else
AReportName := AReportName + 'Print.rtm';
Result := FileExists(AReportName);
end;

var
sReportFile : String;
bmp : TBitmap;
begin
if not LoadReport(sReportFile) then
MsgBox(Format(rstrRTMNotFound, [ExtractFileName(sReportFile)]),
'Error', mtError, [mbOk])
else
begin
bmp := TBitmap.Create;
try
UfrmPPPrint.GetScreenBMP(cdsTeethStatus,
cdsStatusDefinitionPrint, bmp);
imgStatus.Picture.Bitmap.Assign(bmp);
finally
bmp.Free;
end;

with ppReport do
begin
PrinterSetup := glCommon.PrinterSetting;
Template.FileName := sReportFile;
Template.LoadFromFile;
if glCommon.Settings.Preview then
DeviceType := 'Screen'
else
DeviceType := 'Printer';

AllowPrintToFile := True;
PreviewFormSettings.WindowState := wsMaximized;
PreviewFormSettings.ZoomSetting := zs100percent;
SavePrinterSetup := True;
PrinterSetup.PrinterName := glCommon.PrinterSetting.PrinterName;
PrinterSetup.BinName := glCommon.PrinterSetting.BinName;
Print;
glCommon.PrinterSetting.PrinterName := PrinterSetup.PrinterName;
glCommon.PrinterSetting.BinName := PrinterSetup.BinName;
end
end;
end;

procedure TfrmPP.ppImgStatusPrint(Sender: TObject);
begin
if (Sender is TppImage) then
TppImage(Sender).Picture.Bitmap.Assign(imgStatus.Picture.Bitmap);
end;

Comments

  • edited September 2011
    Hi Goran,

    When exporting large images, the ReportBuilder PDF device automatically
    scales the images in order to save space. To prevent this from
    happening, set the PDFSettings.ScaleImages property to False after
    loading the report template.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2011
    Thank You Nico,

    it helps a lot! Now the bitmap is excellent!

    Best regards,
    Goran

This discussion has been closed.