Link to home
Start Free TrialLog in
Avatar of delphibeginner
delphibeginnerFlag for Netherlands

asked on

Custom design printing page

My question is the following:

I try to create a program, which should include a design page, for people to design their own print page. In short terms, the look of the page to be printed.

A couple of items that should be possible to add (through right mouse button or drag-and-drop) are:
- Header (logo).
- Title.
- Text.
- Footer (text or something else).

How can I do this?

Please help.
Avatar of twinsoft
twinsoft
Flag of Greece image

Hi, you should create the design form in your app by using a TImage component and draw on its canvas. Then you print this by assigning your canvas to the printer canvas and use begindoc and enddoc.

uses Printers;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
 Image1.Canvas.TextOut(1, 1, 'Demo Printing');
 Printer.PrinterIndex := Printer.Printers.IndexOf('PrinterName'); // Your printer name
 Printer.BeginDoc;
 Printer.Canvas.Assign(Image1.Canvas);
 Printer.EndDoc;
end;
Avatar of delphibeginner

ASKER

Thanks for the reply.

The items that should be possible to add to the form are not pre-set, for example, the title is a title from a "song" which is in a database, so everytime people want to print they select a "song" to print and it comes out the way they designed the print page.

Is this also possible with TImage?
ASKER CERTIFIED SOLUTION
Avatar of twinsoft
twinsoft
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the reply, sorry I took so long to respond.

I've been looking on the internet for samples to create a custom print page. I saw a sample (not for delphi) that you have a page, with a couple of buttons and text(labels) beneath the design page. I could click on a button or textlabel and drag it to the design page, the button remains below the design page but makes sort of a copy which I can place all around the design page.

Also what I would like but didn't found anything for it is: Clicking right mouse on the design page a click in the popup menu what I would like to add (text, picture, etc). Is there an example (delphi) for the 2 things I described here.

Many thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
none