Solved

Choose paper tray

Posted on 2000-03-02
4
600 Views
Last Modified: 2010-04-04
I have a HP-8100DN printer which provides two paper tray (both are A4),
the trays are labeled tray2 and tray3.
I want to insert plain A4 paper in tray2 and preprinted-A4 in tray3.
I will print 2 or 3 pages with plain-A4 and then some pages with preprinted-A4 within my program. I want to know if there is a way to control which tray to select paper from ?
Thanks to any help.
0
Comment
Question by:flao
4 Comments
 
LVL 1

Expert Comment

by:yk030299
ID: 2579400
if you are using D5, you can specify the outputBin.
0
 

Expert Comment

by:ellessar
ID: 2579582
With quickreports you also have the printersettings.outputbin property of the report:


In the OnBeforePrint event of your detail band just add:

if QRPrinter.PageNumber = 1 then
begin

  if  PrinterSettings.OutputBin <> First then
    PrinterSettings.OutputBin := First;

end
else
  if QRPrinter.PageNumber = 4 then
  begin

    if  PrinterSettings.OutputBin <> First then
      PrinterSettings.OutputBin := Last;

  end;
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2581299
Hi
this example shows how to specify the paper size etc and trays / bins to print to:

unit Unit1;

interface

uses
  Windows, Messages,Printers, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
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.GetPrinter(Device, Driver, Port, hDMode);
  if hDMode <> 0 then begin
    pDMode := GlobalLock(hDMode);
    if pDMode <> nil then begin

     {Set to legal}
      pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
      pDMode^.dmPaperSize := DMPAPER_LEGAL;

     {Set to custom size}
      pDMode^.dmFields := pDMode^.dmFields or
                          DM_PAPERSIZE or
                          DM_PAPERWIDTH or
                          DM_PAPERLENGTH;
      pDMode^.dmPaperSize := DMPAPER_USER;
      pDMode^.dmPaperWidth := 100 {SomeValueInTenthsOfAMillimeter};
      pDMode^.dmPaperLength := 100 {SomeValueInTenthsOfAMillimeter};

     {Set the bin to use}
      pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
      pDMode^.dmDefaultSource := DMBIN_MANUAL;

      GlobalUnlock(hDMode);
   end;
  end;
Printer.PrinterIndex := Printer.PrinterIndex;  Printer.BeginDoc;
Printer.Canvas.Font.Name := 'Courier New';
Printer.Canvas.Font.Size := 10;
Printer.Canvas.Font.Color:=ClRed;
Printer.Canvas.TextOut(100,100, 'Test 1');
Printer.EndDoc;
end;
end.

Regards Barry
0
 
LVL 1

Expert Comment

by:Indefrei
ID: 2581997
additional to Barry's answer
you find the dmbin_params in windows.pas in

....borland\Delphi\source\rtl\bin

cheers
Indi
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
A short film showing how OnPage and Connectwise integration works.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now