A flatbed type printer for performing printing based on print data, the printer comprising: a table including an upper surface on or over which a print medium including a flat print surface is to be placed, a print head disposed above the table and movable at least in an X-axis direction of the XYZ rectangular coordinate system which includes the X-axis direction and the Y-axis direction; a projecting unit configured to project a Gray code pattern on the table; an image taking unit configured to take an image of the Gray code pattern projected on the table by the projecting unit; an image generating unit configured to generate an image of the print surface of the print medium a characterised by the table being movable at least in a Z-axis direction of an XYZ rectangular coordinate system which includes a Y-axis direction and the Z-axis direction; a spatial code generating unit configured to generate a first spatial code image using the image of the Gray code pattern taken by the image taking unit while the Gray code pattern is projected from the projecting unit, with the print medium not placed on or over the table whose upper surface is located at a given position in the Z-axis direction, and configured to generate a second spatial code image using the image of the Gray code pattern taken by the image taking unit while the Gray code pattern is projected from the projecting unit, with the print medium placed on or over the table so that the print surface of the print medium is located at the given position; the generated image being based on the first and second spatial code images; a normalizing unit configured to normalize the print surface so that the print surface assumes a given orientation in the image of the print surface of the print medium; and a converting unit configured to convert print data edited on the normalized print surface into data printable on the pre-normalization print surface. a table including an upper surface on or over which a print medium including a flat print surface is to be placed, a print head disposed above the table and movable at least in an X-axis direction of the XYZ rectangular coordinate system which includes the X-axis direction and the Y-axis direction; a projecting unit configured to project a Gray code pattern on the table; an image taking unit configured to take an image of the Gray code pattern projected on the table by the projecting unit; an image generating unit configured to generate an image of the print surface of the print medium a characterised by the table being movable at least in a Z-axis direction of an XYZ rectangular coordinate system which includes a Y-axis direction and the Z-axis direction; a spatial code generating unit configured to generate a first spatial code image using the image of the Gray code pattern taken by the image taking unit while the Gray code pattern is projected from the projecting unit, with the print medium not placed on or over the table whose upper surface is located at a given position in the Z-axis direction, and configured to generate a second spatial code image using the image of the Gray code pattern taken by the image taking unit while the Gray code pattern is projected from the projecting unit, with the print medium placed on or over the table so that the print surface of the print medium is located at the given position; the generated image being based on the first and second spatial code images; a normalizing unit configured to normalize the print surface so that the print surface assumes a given orientation in the image of the print surface of the print medium; and a converting unit configured to convert print data edited on the normalized print surface into data printable on the pre-normalization print surface.