When the human genome sequence was first mapped in 2001, the thought of using such genetic code to print vaccines on a lab bench was far from reality.

That kind of technology could allow doctors to personalize medicine at their patients’ bedsides or fight epidemics halfway around the world. Or it could allow oncologists to print medicine tailored to target the specific mutations of a patient’s tumor. One day, it could let people print customized prescriptions inside their homes.

These...