User Activity

I'm new to this. When printing from my iPhone over my local network. Trying to print a photo. How does the iPhone know what size paper is in the printer and also know the orientation of the paper in the printer?