Adding form element to output

Poppler takes care of almost everything, I simply added the form tags at the end of every page.
I went ahead and cleaned it up as you suggested. However I had a question regarding the conversion process, from double or int to string. How come int are transferred in hexadecimal string of number, and not the case for double? Also in your example, wid and hid are of the long long type : I tried to use the same type, but in my case they are converted to hexadecimal number, which is obviously not going to work... Any idea why that is?