Ferdinand VII of Spain was recognized as his son by Charles IV .
The eldest surviving child of Charles IV , King of Spain and Maria Luisa of Parma , Ferdinand was born in the vast palace of El Escorial near Madrid .
Ferdinand VII of Spain