Custom printing of PDF pages (rotation & scaling)

Q:

I need to rotate page 90 lr 270 degrees such that all elements print
exactly the same size. Elements are getting scaled to fit new
landscape width and height. I need to print the page using the same
size (scaling) as when portrait, just rotated.
-----

A:
You can rotate the page prior to printing using
page.SetRotation(angle). Currently the code snippet in PDFPrint sample
project uses DrawInRect to draw the page across the entire paper while
keeping aspect ratio of the input PDF page.

If you would like to print the page using exactly the same scaling
that you use in the portrait mode, the rectangle parameter in
pdfdraw.DrawInRect should have the same width that you use in the
portrait mode. Of course, in this case some parts of PDF page may not
be visible (i.e. they would lie outside of the bounds of the physical
page).

For example,
rect.x1 = 0; rect.x2=rect.Height(); // or something similar
pdfDraw.DrawInRect(page, gr, rect)