我在用证卡打印机在PVC卡上打印图像(数码相机拍摄的相片)时遇到以下问题:
一、相片区域全部为黑(即是一个全黑的相片),这种情况有点像随机的,但有时连续都出现。我使用TQRImage和FastReport下的TfrPictureView都出现这种问题。
二、如果将相片自动处理(如:ColorPolit----专门用于偏正数码相机的白平衡与曝光问题),则不管在屏幕上显示的对比度、亮度如何,打印出来的相片都特别偏亮。而在屏幕看起来比较亮而未经处理的相片也不会出现这种情况。

解决方案 »

  1.   

    简单的图形打印:
    procedure TForm1.BitBtn1Click(Sender:TObject);
    begin
      if printdialog1.execute then
        begin
          printer.begindoc;
          printer.canvas.draw(0,0,image1.picture.graphic);
          printer.enddoc;
        end;
    end;
    这个使用的是打印机的分辨率,就造成打印机打出的图形很小。不过我可以利用打印机画布canvas的stretchdraw方法灵活控制。
    StretchDraw方法的声明:
    procedure StretchDraw(constRect:TRect;Graphic:TGraphic);
    Rect代表图形输出的区域大小,TRect的类型声明;
    TRect=record
    case Integer of
    0:(Left,Top,Right,Bottom:Integer);
    1:(TopLeft,BottomRight:TPoint);主要代码如下:
    procedure TForm1.Button1Click(Sender:TObject);
    var
      //定义打印输出矩形框的大小
      strect:Trect;
      temhi,temwd:integer;
    begin
      if printdialog1.execute then
        begin
          temhi:=image1.picture.height;
          temwd:=image1.picture.width;
          //将图形放大到打印页面的1/2
          while (temhi<printer.pageheight div 2)and(temwd<printer.pagewidth div 2) do
            begin
              temhi:=temhi+temhi;
              temwd:=temwd+temwd;
            end;
          //定义图形在页面上的中心位置输出
          with strect do
            begin
              left:=(printer.pagewidth-temwd) div 2;
              top:=(printer.pageheight-temhi) div 2;
              right:=left+temwd;
              bottom:=top+temhi;
            end;
          with printer do
            begin
              //将放大的图形向打印机输出
              begindoc;
              canvas.stretchdraw(strect,image1.picture.graphic);
              enddoc;
            end;
         end;
    end;
      

  2.   

    简单的图形打印:
    procedure TForm1.BitBtn1Click(Sender:TObject);
    begin
      if printdialog1.execute then
        begin
          printer.begindoc;
          printer.canvas.draw(0,0,image1.picture.graphic);
          printer.enddoc;
        end;
    end;
    这个使用的是打印机的分辨率,就造成打印机打出的图形很小。不过我可以利用打印机画布canvas的stretchdraw方法灵活控制。
    StretchDraw方法的声明:
    procedure StretchDraw(constRect:TRect;Graphic:TGraphic);
    Rect代表图形输出的区域大小,TRect的类型声明;
    TRect=record
    case Integer of
    0:(Left,Top,Right,Bottom:Integer);
    1:(TopLeft,BottomRight:TPoint);主要代码如下:
    procedure TForm1.Button1Click(Sender:TObject);
    var
      //定义打印输出矩形框的大小
      strect:Trect;
      temhi,temwd:integer;
    begin
      if printdialog1.execute then
        begin
          temhi:=image1.picture.height;
          temwd:=image1.picture.width;
          //将图形放大到打印页面的1/2
          while (temhi<printer.pageheight div 2)and(temwd<printer.pagewidth div 2) do
            begin
              temhi:=temhi+temhi;
              temwd:=temwd+temwd;
            end;
          //定义图形在页面上的中心位置输出
          with strect do
            begin
              left:=(printer.pagewidth-temwd) div 2;
              top:=(printer.pageheight-temhi) div 2;
              right:=left+temwd;
              bottom:=top+temhi;
            end;
          with printer do
            begin
              //将放大的图形向打印机输出
              begindoc;
              canvas.stretchdraw(strect,image1.picture.graphic);
              enddoc;
            end;
         end;
    end;
      

  3.   

    不好意思,发了两次。
    注:将printers加入到Interface和Implementation的Uses语句中。
      

  4.   

    咳咳~ 人家使用QReport的吧~ 不使用canvas的~
      

  5.   

    这段时间忙于其它项目建设,没时间做这个。但yuhouyangguang(雨后阳光) 方法不行,问题还未解决。
    现在离交货时间越来越近了,有兄弟遇到类似问题吗?