Solved

Choose paper tray

Posted on 2000-03-02
4
603 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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