It used to be, and remains, possible for one's program to output (encapsulated) postscript by simply writing some lines in a text file. To draw an 'x' one might for instance write
%!PS
%%BoundingBox: 0 0 100 100
newpath 100 0 moveto 0 100 lineto stroke
newpath 0 0 moveto 100 100 lineto stroke
showpage
Is there an equivalent method to output pdf?
Edit
Please do suggest an inelegant, regular, or luxurious way to output pdf.
An inelegant method would be one that still passes by eps. A regular one would be one that parallels the eps text file above. A luxurious method would be a comfortable API/library.
Edit2
A "regular" solution is platform neutral, but a solution in neither the first nor the third categories is. So let me clarify that I am looking for a solution using Java on android.