如何在win2000下对自定义纸张进行打印?

解决方案 »

  1.   

    在报表设计时用自定义纸张custom size把纸长宽输进去,按apply,然后再把纸号选为default size,然后再设计表。然后再再控制面板打印机文件夹中右键单击空白处,点击服务器属性,自定义你的纸张。在打印这种票据前,先选中这种纸。
      

  2.   

    打印机纸张类型要与TQickRep中设置要一致。
    再自定义纸张的尺寸。
      

  3.   

    我没有试过这样面的尝试,不过我有资料供你参考
    在执行打印前调用以下函数:
    procedure SetPaperSize(X, Y: Integer);
    // 单位是0.1mm
    // A4时 Printer.Pagewidth:=1440;  A5时 Printer.Pagewidth:=1049;
    // B5时 Printer.Pagewidth:=1290;  16K时 Printer.Pagewidth:=1035;
    // lq1600宽行打印机这个值宽度最大为42cm左右, 长度大约2m。
    //改变devicemode结构
    var
      Device: array[0..255] of char;
      Driver: array[0..255] of char;
      Port: array[0..255] of char;
      hDMode: THandle;
      PDMode: PDEVMODE;
    begin
      Printer.PrinterIndex := Printer.PrinterIndex;
      Printer.GetPrinter(Device, Driver, Port, hDMode);
      if hDMode <> 0 then
      begin
        pDMode := GlobalLock(hDMode);
        if pDMode <> nil then
        begin
          if (x = 0) or (y = 0) then
          begin
            {Set to legal}
            pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
            {pDMode^.dmPaperSize := DMPAPER_LEGAL; changed by wulianmin}
            pDMode^.dmPaperSize := DMPAPER_FANFOLD_US;
          end
          else
          begin
            {Set to custom size}
            pDMode^.dmFields := pDMode^.dmFields or
              DM_PAPERSIZE or
              DM_PAPERWIDTH or
              DM_PAPERLENGTH;
            pDMode^.dmPaperSize := DMPAPER_USER;
            pDMode^.dmPaperWidth := x {SomeValueInTenthsOfAMillimeter};
            pDMode^.dmPaperLength := y {SomeValueInTenthsOfAMillimeter};
          end;
          {设定纸张来源}
          pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
          pDMode^.dmDefaultSource := DMBIN_MANUAL;      GlobalUnlock(hDMode);
        end;
      end;
      Printer.PrinterIndex := Printer.PrinterIndex;
      //以下开始打印
      Printer.BeginDoc;
      Printer.Canvas.TextOut(100,100, 'Test 1');
      Printer.EndDoc;
    end;
      

  4.   

    我用到了下面这一段  Printer.PrinterIndex := Printer.PrinterIndex;
      Printer.GetPrinter(Device, Driver, Port, hDMode);
      if hDMode <> 0 then
      begin
        pDMode := GlobalLock(hDMode);
        if pDMode <> nil then
        begin
          if (x = 0) or (y = 0) then
          begin
            {Set to legal}
            pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
            {pDMode^.dmPaperSize := DMPAPER_LEGAL; changed by wulianmin}
            pDMode^.dmPaperSize := DMPAPER_FANFOLD_US;
          end
          else
          begin
            {Set to custom size}
            pDMode^.dmFields := pDMode^.dmFields or
              DM_PAPERSIZE or
              DM_PAPERWIDTH or
              DM_PAPERLENGTH;
            pDMode^.dmPaperSize := DMPAPER_USER;
            pDMode^.dmPaperWidth := x {SomeValueInTenthsOfAMillimeter};
            pDMode^.dmPaperLength := y {SomeValueInTenthsOfAMillimeter};
          end;
          {设定纸张来源}
          pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
          pDMode^.dmDefaultSource := DMBIN_MANUAL;      GlobalUnlock(hDMode);
        end;
      end;然后调用quickreport 打印,还是没有作用(在win2000下),98就可以