I have done this in the past and it involves creating a Form object using AddForm (part of the Windows Print Spooler API) then selecting that form when printing. You can also define a custom form manually through printer settings which may be better for you if your not distributing your software to other people.
The following links may help: http://support.microsoft.com/default.aspx?scid=kb;en-us;282474 http://www.codeproject.com/Questions/170206/Create-custom-paper-sizes-or-forms-in-Windows http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_27302107.html http://msdn.microsoft.com/en-us/library/windows/desktop/dd183328(v=vs.85).aspx Regards Andrew Technical Manager Object Connections Australia Common Knowledge - Business Rules for Delphi www.objectconnections.com On Thu, Oct 4, 2012 at 2:33 AM, K2RFP <rn...@verizon.net> wrote: > Stephen: > Yes, I'm using an old dot matrix printer and with raw printing > I'd be locked into the fonts available to it and printing a > graphic as well would be a task! I'm going to try changing > the physical size of the page to 1 inch since that is the > size of the label. > Thanks for taking the time to reply. > Dick. > > On 10/3/2012 12:00 PM, Stephen Posey wrote: >> >> When the TPrinter class was developed, dot-matrix printers and fan-fold >> paper were on their way out, and page oriented printing on ink-jet and laser >> printers was becoming the norm; so I don't think a lot of thought was put >> into giving the kind of control needed to do more specialized jobs like >> yours. >> >> Raw printing may be a possibility, though more recent versions of Windows >> have made talking directly to the ports like that increasingly awkward and >> difficult. That can certainly improve throughput for dot-matrix printers by >> using the native resolution and fonts; though for one off labels performance >> at that level is probably not a big concern. >> >> I'd say the easier route will be to treat a single label as a page, >> adjusting your page size accordingly (probably need a custom page size for >> this). That way, when you call .EndDoc you should only advance to the next >> label. >> >> Hopefully the distance between the last label on an actual page of labels >> and the first on a subsequent page is comparable to that between labels on a >> page (which was typical for old fan-fold labels, IIRC), otherwise you may >> have to manually adjust the printer after each page (PITA). >> >> HTH >> >> Stephen Posey >> stephenlpo...@earthlink.net >> >> BTW, I prefer "Stephen" please. >> >> -----Original Message----- >>> >>> From: K2RFP <rn...@verizon.net> >>> Sent: Oct 3, 2012 10:32 AM >>> To: Delphi-Talk Discussion List <delphi-talk@elists.org> >>> Subject: Re: Printing Labels >>> >>> Steve: >>> Writing a procedure to handle a batch of labels is >>> not a problem but that is not what I want. As a ham >>> radio operator I have, from time to time, to send >>> a postcard to someone in my log book. So it is an >>> individual label and the procedure is not called for >>> every time I run the logbook program. So it doesn't >>> make sense for the printer to do a form feed to a >>> new page after printing one or two labels. >>> >>> I did some google searching and found out that >>> EndDoc always results in a form feed and a way >>> around it is to do a raw printing to the printer >>> port. I haven't tried that. Another way I'll try >>> is to set the physical size of the printer's page >>> to the height of the label. You would think there >>> would be an EndDoc2 procedure that does what EndDoc >>> does but stops the printer in its tracks so I would >>> not have to jump through hoops to do what I want. >>> >>> >>> On 10/3/2012 9:55 AM, Stephen Posey wrote: >>>> >>>> I'm not sure I understand the question here. >>>> >>>> Normally you don't call Printer.EndDoc until you're done printing. If >>>> you have multiple labels to print, then you'll want to handle them as a >>>> "batch" and compose them all onto your label page(s) before calling >>>> Printer.EndDoc. >>>> >>>> If the number of labels you have to print is more than will fit on a >>>> page of labels, then you'll call Printer.NewPage between page batches. >>>> >>>> If that doesn't clarify the situation then I'll need you to describe >>>> your setup and exactly what you're trying accomplish in more detail. >>>> >>>> Stephen Posey >>>> stephenlpo...@earthlink.net >>>> >>>> -----Original Message----- >>>>> >>>>> From: -K2RFP- <rn...@verizon.net> >>>>> Sent: Oct 2, 2012 1:25 PM >>>>> To: Delphi-Talk Discussion List <delphi-talk@elists.org> >>>>> Subject: Printing Labels >>>>> >>>>> I want to print individual 1-inch labels on fan-fold >>>>> tractor feed paper. The label prints okay but the >>>>> EndDoc statement causes thepaper to move to the next >>>>> page. How do I get it tomove to the next label? >>>>> >>>>> The printer does not have any setting for labels. >>>>> >>>>> >>>>> >>>>> __________________________________________________ >>>>> Delphi-Talk mailing list -> Delphi-Talk@elists.org >>>>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk >>>> >>>> __________________________________________________ >>>> Delphi-Talk mailing list -> Delphi-Talk@elists.org >>>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk >>>> >>> __________________________________________________ >>> Delphi-Talk mailing list -> Delphi-Talk@elists.org >>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk >> >> __________________________________________________ >> Delphi-Talk mailing list -> Delphi-Talk@elists.org >> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk >> > > __________________________________________________ > Delphi-Talk mailing list -> Delphi-Talk@elists.org > http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk -- Andrew Rutherford Technical Manager Object Connections Australia P. +61 249573146 E. andrew.rutherf...@objectconnections.com M. +61 419263591 W. www.objectconnections.com Notice - The information and attachment(s) contained in this communication are intended for the addressee only, and may be confidential and/or legally privileged. If you have received this communication in error, please contact the sender immediately, and delete this communication from any computer or network system. Any interception, review, printing, copying, re-transmission, dissemination, or other use of, or taking of any action upon this information by persons or entities other than the intended recipient is strictly prohibited by law and may subject them to criminal or civil liability. Object Connections Australia shall not be liable for the improper and/or incomplete transmission of the information contained in this communication or for any delay in its receipt. __________________________________________________ Delphi-Talk mailing list -> Delphi-Talk@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk