Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Choose paper tray

Posted on 2000-03-02
4
Medium Priority
?
612 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 300 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

926 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