Correct resolution/screen size for an A4 piece of paper

I posted this question some time ago:

asking if it was possible to generate an image to print, and I learned about Application.CaptureScreenshot(). I tested it and it served my purposes perfectly.

Now I’d like to ask about formating the image. I would like to make it so when I take the screenshot, it fits perfectly in an A4 paper, for printing, but I don’t know how to archieve this. Do I have to choose a certain resolution for the “game”? Should I use an ortographic camera? I read here: What is standard A4 paper size in pixels for a given resolution? - Super User
that the standard size of the paper is 210mm × 297mm (8.27in × 11.69in), and that doing some calculations I don’t understand, he arrived at the value 4960 x 7016 pixels. The problem is, I don’t know what to do with this value. I tried setting this as the resolution of the “game” (not allwing the user to change it) but it doesn’t seem to be right.

thanks in advance for any help.

about halfway down they start getting to the good stuff.

I’ll give you a couple of tips about how you can manage this :

  1. If you wish to produce documents for high-quality prints, you will need to use at least :

    public static void CaptureScreenshot(string XXXXX, int superSize = 4);

XXXXX is meant for the file path and file name.

This will produce a file that can be printed at between 288 DPI and above 480 DPI depending on your screen resolution. I specify the difference because the screenshot taken is based on the data rendered through your device graphics’ bandwidth. Some screen and devices display at an equivalent of 72 DPI while others do it at 92 DPI (like Smartphones). Recent iPhone render at above 120 DPI which (which allow crystal clear buttons and layouts).

  1. On the other side, it doesn’t mean that all device will be able to render such screenshot. Remember that some devices don’t have enough temporary memory bandwidth to store as much as 4x the fullscreen worth of RGB data that is required during the process. You might have to allow the user to force a lower resolution onto the application. For example, a big screenshot on a big high definition screen can take up to 256MB of memory bandwidth just to temporary store the screenshot without counting the actual requirement of the software itself. It’s only for a short time, but it’s a huge memory spike which can be hated by the user if his device become unresponsive for a 1 or 2 sec thinking the application crashed.

This is why I suggest you allow the user to select his preferred quality setting since you can give him/her such ability to do so just by storing a int value and returning it in CaptureScreenshot().

  1. For the Format, it can be done, but it require a bit of voodoo magic. :wink:
    You got to do it in multiple steps.
    First, you force the window into a specific resolution in window mode:
    Unity - Scripting API: Screen.SetResolution

This resolution must be of the same ratio as the paper size you’re aiming for. In case of the A4, the ratio is 1:1.414 (depending on the orientation you’re aiming for, you might have to rotate the camera and UI by 90 degrees before taking the screenshot). You could force the window mode and specific resolution based on the actual user’s screen resolution (so that the size of the application become as big as possible). You will have to store the original resolution and if the window mode was already active or not.
Then, you make it so that Unity call the CaptureScreenShot();. After 1 or 2 sec, you do a check to confirm if the file is at the path (you have to store the path and file name in some variable to be able to compare). If the file is confirmed, the application can restore itself in the previously stored Window and Resolution.

If you wish to add more, you can even give the option to open the file path once the file is confirmed :

 FilePath = FilePath.Replace(@"/", @"\");   // explorer doesn't like front slashes
 System.Diagnostics.Process.Start("explorer.exe", "/select,"+FilePath );