The paraphrase “print only what is needed” is helpful here in understanding the meaning. But I see is needed as a reduced clause with no overt grammatical subject, functioning as complement to the preposition as. It can be reduced further to just the predicative complement: print only as much as needed. In this analysis only as much as is needed is a noun phrase,