Solved

Printing

Posted on 2003-11-22
1
258 Views
Last Modified: 2010-04-03
Hi,

I need to know how I can set a printers properties to be default at Tractor Feed.
Every time I use my printer the paper source resets itself to Manual Feed. I have disabled Manual and Sheet Feeder in the printer properties but this doesnt work.

When I select my printer using the printerdialog I need the default paper source to be Tractor and paper output to be 8 1/2 x 11.

Is there any way I can set this in code? Im using Delphi 5 Prof and the dialog is TPrinterDialog

Any suggestions would be great,
Thanks
0
Comment
Question by:HotRod40
1 Comment
 
LVL 3

Accepted Solution

by:
Peter_ earned 100 total points
ID: 9805654
Havent tried this yet, but I found the sample on the net and it looks like it could work. Try setting the different properties of pDMode:

//-------------------------------------------------------------------------

procedure TForm1.Button2Click(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.PrinterIndex := Printer.PrinterIndex;
  Printer.GetPrinter(Device, Driver, Port, hDMode);
  if hDMode <> 0 then begin
    pDMode := GlobalLock(hDMode);
    if pDMode <> nil then
    begin
      pDMode^.dmPaperSize:=DMPAPER_LEGAL;
      { There are many more parameters here you can try, and other properties like pDMode^.dmDefaultSource
      for example. }
      GlobalUnlock(hDMode);
    end;
    GlobalFree(hDMode);
  end;
end;

//------------------------------------------------------------------------

If all else fails, then maybe you could try using SendKeys on the dialog?
 
Depends on if you are able to get hold of the right window. Takes some "trial and error programming", but sometimes it does the trick. See http://www.cbuilder.ru/faqs/faqd_en/16500.html http://www.209software.com/Books/p4dp/sendkeys.html for a sample.
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 104
can't find the executable in Simulator 1 112
Dev express lookupcombo 3 44
how to change, disabled button color FMX ? 1 48
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

713 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