Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How can I change page dimensions in code?

edited February 2002 in General
I have a client who requires to print some text on one of four labels on an
A4 sheet.

The label (clear) is then stuck onto a Taxi Licence Plate (e.g. like you see
on the back of a licensed taxi).

I would like the screen preview to show the end result e.g. show a taxi
plate with logos, etc. and therefore wish to set the page dimensions to the
size of the plate.

However, just before printing to the printer, I need to change the page
dimensions to A4, then ask the user which of the 4 labels to print on.

I have managed everything in RAP code EXCEPT the ability to change the page
dimensions. I am doing most of this in the ReportOnPrintDialogCreate event -
is this too late to change the page dimensions? If so, where should I do it
instead?

As always, you help would be much appreciated.

P.S. If you are interested in my code for displaying a user-input form with
a user-definable TGrid that returns the user-selected column and row number,
please let me know. Other may find it helps to get them started!

Comments

  • edited February 2002
    Hi,

    one way is to create four subreports with the correct page sizes and
    just load the needed subreport based on the users choice.

    enjoy,
    Ron.

  • edited February 2002
    Thanks for the thought but I fear this would be a bit too hard for an
    end-user to modify easily.

    The same method would also be used for printing driver identity badges - but
    they can have 8 or even 16 labels per sheet - this would need a lot of
    subreports!

    I'm after something easy I can do in RAP code and which is dependent on the
    end-user setting the page size and the number of labels available on the A4
    sheet (in code).

    Any more suggestions?

  • edited February 2002
    You could code a RAP pass through function to get the paper name from what
    the user has selected.

    In the RAP Report BeforePrint event handler you can say
    Report.PrinterSetup.PaperName := MyPassThruGetPaperName;

    There are pass through function tutorials in the installed RAP demos
    directory.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.