Just curious to know how can I generate a pdf file programmatically. I mean I know there are libraries in most of the programming languages to do so but I want to do it from scratch just like creating a text file. Open file.txt, write the data and close the file. But I guess, I can't do something like open a file.pdf, write data to it and then close the file. So How can I do it without any third party libraries.