Question

Let’s say I have a PrintDocument with unknown number of pages. How could I scale it to fit everything on one page?

Edit: I am trying to achieve something like “fit to page” when printing.

Was it helpful?

Solution

If you don't know how many pages your document has, you will never ever be able to find out the right scaling. You have to put some effort in finding out the amount of pages and then you will be able to set the scaling.

Edit:

One hint for measuring the pages: Print out the document "blind" (will say not to the printer, print it to a graphics you will get with PrinterSettings.CreateMeasurementGraphics() like Hans Passant stated in his comment). Then you will have the amount of pages. You can then set the scaling and print the document the second time, but this time direct to the desired printer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top