kbd
kbd

Reputation: 4439

Printing two A5 pages on a single A4 page - configure print settings by code

Requirements

We have a custom application (print service) that prints any document to the desired network printer.

This is done building upon:

System.Drawing.Printing

Specifically:

The application has been running fine for some time, recently I received a change request to support the following:

It must be possible to print A5 documents on A4 pages, in two-per-page fashion

That means we have to be able to support these manual print options by code:

enter image description here

enter image description here

I would think this should be possible, I just don't know where to look.

Can PrintDocument do this? If so, by which settings? Is there anything else that I can use for this?

Upvotes: 0

Views: 1056

Answers (1)

Dan Byström
Dan Byström

Reputation: 9244

If your current code is printing to a Graphics object, like this:

public void Print(Graphics g);

Then you should be able to squeeze in two page outputs on the same physical page like so:

  g.Transform = create matrix scaled to 50% and rotated 90°
  page1.Print(g);
  g.Transform = create matrix scaled to 50%, rotated 90° and translated half a page, 
  page2.Print(g);

Upvotes: 1

Related Questions