Researchers at Glasgow University have developed a new process which they say can "print" drugs.
They are using 3D printing technology which could in theory lead to people having a "personal pharmacy" dispensing medicines at home.
A variety of molecules have already been made, including some anti-cancer drugs.
The team said its research could make it possible to diagnose an illness before it occurs - and produce a cure.
A new research paper, published in the journal Nature Chemistry, outlines how the process has been shown to work.
Using a commercially-available 3D printer operated by computer-aided design software, Prof Lee Cronin and his team have built what they call "reactionware".
These are tiny vessels in which chemical reactions can take place - but the vessels have the chemicals that drive the reactions already built in.
While this is common in large-scale chemical engineering, the development of reactionware makes it possible for the first time for custom vessels to be fabricated on a laboratory scale, Prof Cronin said.
He added: "It's long been possible to have lab materials custom-made to include windows or electrodes, for example, but it's been expensive and time-consuming.
"We can fabricate these reactionware vessels using a 3D printer in a relatively short time. Even the most complicated vessels we've built have only take a few hours.
"By making the vessel itself part of the reaction process, the distinction between the reactor and the reaction becomes very hazy. It's a new way for chemists to think, and it gives us very specific control over reactions because we can continually refine the design of our vessels as required.
"For example, our initial reactionware designs allowed us to synthesize three previously unreported compounds and dictate the outcome of a fourth reaction solely by altering the chemical composition of the reactor."
Although the technology they are developing is still at an early stage, the team, comprised of researchers from the University's School of Chemistry and School of Physics and Astronomy, is also considering the long-term implications of developments in 3D printing technology.
Prof Cronin added: "3D printers are becoming increasingly common and affordable. It's entirely possible that, in the future, we could see chemical engineering technology which is prohibitively expensive today filter down to laboratories and small commercial enterprises.
"Even more importantly, we could use 3D printers to revolutionise access to health care in the developing world, allowing diagnosis and treatment to happen in a much more efficient and economical way than is possible now.
"We could even see 3D printers reach into homes and become fabricators of domestic items, including medications. Perhaps with the introduction of carefully-controlled software 'apps', similar to the ones available from Apple, we could see consumers have access to a personal drug designer they could use at home to create the medication they need."
Prof Cronin's paper is published in Nature Chemistry.