The document has to be created in memory which is the case if cpdf_open() has been called with no filename parameter.
The cpdf_output_buffer() function outputs the pdf document to stdout. The document has to be created in memory which is the case if cpdf_open() has been called with no filename parameter.