Solved

Choose paper tray

Posted on 2000-03-02
4
604 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

632 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