Re: [Cppcms-users] HTTP response and binary stream (libharu)
Brought to you by:
artyom-beilis
|
From: augustin <aug...@ov...> - 2015-09-17 13:17:02
|
On Thursday, September 17, 2015 07:07:21 PM Joerg Sonnenberger wrote:
> On Thu, Sep 17, 2015 at 05:52:03PM +0800, augustin wrote:
> > I am trying to get my cppcms application to output a PDF file (using
> > libharu). However, I seem to have a problem returning the binary output.
> > It seems that the cppcms internals are corrupting the stream.
>
> Works fine for me, but I don't set raw mode or anything like that, just:
>
> response().content_type("application/pdf");
> response().out() << pdf;
>
> where pdf is a std::string.
Thanks, but pdf is not a std::string.
It is a HPDF_Doc from the libharu library, which is used to create documents
following the PDF standard.
A PDF file may include binary streams.
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.
Right now, I am learning about the complexities of having binary streams in
C++. There are quite a few articles on the topic on the internet.
My main question is:
is it a problem in my own code, or is it a shortcoming of the cppcms library,
that it cannot handle binary streams? Does cppcms need to be patched or should
I handle the stream differently on my end?
thanks,
augustin.
|