It took me a lot of trial and error, but I can now generate the correct MRZ (Machine Readable Zone) content with a bit of HTML and JavaScript. Verified with various passport/identity card scanning apps :) Getting the input for the composite checksum right was quite frustrating, but it works now :)