[Cppcms-users] PoDoFo? Re: HTTP response and binary stream (libharu)
Brought to you by:
artyom-beilis
From: augustin <aug...@ov...> - 2015-09-18 08:53:40
|
On Thursday, September 17, 2015 09:46:41 PM Joerg Sonnenberger wrote: > On Thu, Sep 17, 2015 at 09:16:42PM +0800, augustin wrote: > > I have no problem outputting HTML (std::string). > > I have no problem outputting simple PDF files which only include a stream > > of strings. > > But when I try creating more complex PDF files with drawings or pictures > > (i.e. PDF files including binary streams), the file gets corrupted and > > is not rendered properly. > > Try creating a std::stringstream with std::ios::binary and write to that > from your library. That's what I'm already doing. From the code I posted at the beginning: std::ostringstream cppcms_buf(std::ios::binary); ... // cppcms::http::response: app()->response().out() << cppcms_buf.str(); > Use the stringstream -> string accessor and write > that. That's what I am doing when creating PDFs from PoDoFo. Do your pdf contain only plain text, or do they contain graphics? Can you post a simple hello_world.pdf code, especially the part where the generated PDF is sent back via the cppcms output stream: cppcms::http::response().out() ? I hesitated between using libharu and PoDoFo. Neither library is well documented. I just started with libharu but it's not too late to switch to another library. Are you happy with PoDoFo? Thank you, Joerg. augustin. . |