write string to pdf file

I need to write a String object "plain text" to a pdf file from a java program, does java or spring have any built-in libraries that can do the job.if not what are the best choice external libraries?
I know I can use FileOutputStream to write data to a file but is there any option that can format the data in pdf and write it to the file, like .setContentType("application/pdf") of the HttpServletResponse
thanks in advance


If you need to edit/update a PDF document and you dont want to use any libraries, then you will have to implement the PDF specs yourself. http://en.wikipedia.org/wiki/Portable_Document_Format

However, doesn't look very simple. So I would recommend not to reinvent the wheel and to use libraries like iText.

Regarding the mime type, yes it is application/pdf . More details here Proper MIME media type for PDF files

链接地址: http://www.djcxy.com/p/8188.html

上一篇: 如何打开没有.pdf扩展名的pdf网址?

下一篇: 将字符串写入pdf文件