[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

OutPut Bin Selection for a printer

Posted on 2000-01-04
5
Medium Priority
?
1,107 Views
Last Modified: 2010-08-05
I am working on a project with Oracle 8 as Back end and Delphi 4 as front End.
The printer we use now is HP LaserJet 4050TN. Now we have 4 bins in it and the report we are using is Quick Report
latest vesrion. Here the first bin(Manual) is detected by Selecting 'First  ' in TQRBIN.second bin is selected using 'lower' and the fourth is selected using 'Last'. But I cannot pass a bin for Third bin .I tried with 'Middle' but it is not been recognised and it takes the default. Now I have kept the 3rd bin as default in the Printer properties. Please give me a Solution for this. Is there anything like Escape Sequence(DOS) for Windows to choose the Bin


0
Comment
Question by:sethuraj
5 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2324268
here is example of changing  the   papersizes and bins:

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.


press ctrl space after DMBIN_
for a list of bins you can use.one of them is DMBIN_USER which may be what your after.
Regards Barry
0
 

Accepted Solution

by:
PradeepPrabhakar earned 140 total points
ID: 2324321
You can use the DeviceCapabilities API function "DeviceCapabilities" declared in the WinSpool.pas with the DC_BINS or the DC_BINNNAMES parameters to retrieve an array of bins installed for the printer you are querying or the array of names of the bins you want to access respectively.
The DC_BINNAMES parameter retreives an array of PDeviceMode datatypes. The Delphi implementation of this data structure is in the Windows.pas
0
 

Expert Comment

by:rajeshvee
ID: 2324846
If U use the above method by Mr .Pradeep U don't have to write a wrapper function for the Api.

rajesh.vijayakumar.
0
 

Expert Comment

by:PradeepPrabhakar
ID: 2326413
No you do not have to create a wrapper. It is already wrappered in the WinSpool.Pas. For the implementation look in the /Delphi/Source/Rtl/Win directory.
0
 

Author Comment

by:sethuraj
ID: 2326537
Thanx Guys
I will check and return
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

591 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