1. An apparatus comprising: a character extraction unit configured to extract a character string from a document including layout information; a heading determination unit configured to determine whether the extracted character string is a heading based on a heading tag, a character size and a line space between character strings; a character width acquisition unit configured to acquire space character width information; a spacing amount determination unit configured to determine a spacing amount of each inter-character space based on the character string extracted by the character extraction unit and the layout information; and an insertion unit configured to determine whether a space character is to be included in each inter-character space based on the spacing amount of each inter-character space determined by the spacing amount determination unit and the space character width information acquired by the character width acquisition unit, and to insert a space character code into an inter-character space in which a space character is determined to be included, wherein, when the heading determination unit determines that the extracted character string is the heading, the insertion unit is configured to correct the space character width information acquired by the character width acquisition unit, and to determine whether the space character is to be included in each inter-character space based on the spacing amount of each inter-character space and the corrected space character width information, and to insert the space character code into the inter-character space in which the space character is determined to be included.