If you really want to do this, download a copy of the PDF specification, and read it. (It is only 978 pages ... it won't take that long to read ...) Then design and implement a program that generates a byte stream that conforms to the specified format and contains the information you want to output with a suitable layout, etcetera.
You could probably produce a simple "hello world" document in a week or three. But it would take you years (and many versions) to get to the level of sophistication of one of the existing libraries.
A better idea is to not waste your time reinventing the wheel.