Scientists are pioneering the use of 3D printers to create drugs and other chemicals at the University of Glasgow.
Researchers have used a £1,250 system to create a range of organic compounds and inorganic clusters - some of which are used to create cancer treatments.
Longer term, the scientists say the process could be used to make customised medicines.
They predict the technique will be used by pharmaceutical firms within five years, and by the public within 20.
"We are showing that you can take chemical constituents, pass them through a printer and create what is effectively a chemical synthesiser in which the reaction occurs allowing you to get out something different at the end," researcher Mark Symes told the BBC.
"We're extrapolating from that to say that in the future you could buy common chemicals, slot them into something that 3D prints, just press a button to mix the ingredients and filter them through the architecture and at the bottom you would get out your prescription drug."
The 3D printing process involves the use of a robotically controlled syringe which builds an object out of a gel-based "ink", into which chemicals and catalysts are mixed.
"Chemists normally put chemicals in glassware to create a reaction," said Prof Lee Cronin, who came up with the idea.
"What we are doing is mixing the concept of the glassware and the chemicals together in the 3D printer to create what we call 'reactionware'.
"It's almost like a layer cake - you print the last reactionary agent first and then build other chemical layers above, finally adding a liquid at the top. The liquid goes to layer one making a new molecule which goes to the next layer creating another and so on until at the bottom you get your prescription drug out."
Until now the researchers have used bathroom sealant to create their reactor, and the substances created have not been suitable for human consumption.
But the scientists say their next step is to switch ingredients and replicate drugs already available in pharmacies. They also hope to work with engineers to increase the printer's speed and resolution.
If successful, they say doctors and individuals could ultimately download pre-set recipes and even tailor medicines to their individual needs.
"This would not only place traditionally expensive chemical engineering technology within reach of typical laboratories and small commercial enterprises, but also could revolutionise access to healthcare and the chemical sciences in general in the developing world," they wrote in a paper published in the Nature Chemistry journal .