So I'm trying some small code to generate a pdf:


void User::render2pdf() {


    Wt::WPdfImage pdfImage2("210mm",  "297mm");

    {

        Wt::WPainter p(&pdfImage2);

        p.setFont(Wt::WFont());

        p.setPen(Wt::SolidLine);

        p.drawLine(1,1,2,2);

        p.drawText(0,0,20,20,{Wt::AlignCenter}, "Hello");

    }

    std::ofstream file("chart.pdf", std::ios::out | std::ios::binary);

    pdfImage2.write(file);


It's dying on the WPainter creation line.



The error given is:


unknown location(0): fatal error in "UserRendertopdf": std::exception:
WPdfImage error: error_no=102B, detail_no=0


The Wt line where this happens is: wt/src/Wt/WPdfImage.C:316

font_ = HPDF_GetFont (pdf_, font_name, "UTF-8");

The reference for this func is:
http://libharu.org/wiki/Documentation/API/Document#HPDF_GetFont.28.29

The reference for the error code says "An Invalid encoding name is
specified." - http://libharu.org/wiki/Documentation/Error_handling

The "UTF-8" encoding is not listed in the libharu pages:
http://libharu.sourceforge.net/fonts.html

I grepped the libharu source for utf and couldn't find anything. It does
have a lot of stuff to do with unicode though.

Some older forum posts mentioned a plugin source file for UTF-8 but said
that it'll be included in future versions of libharu. We are now in those
future versions.

Any guidance or ideas appreciated.

Many Thanks,
Matthew Sherborne
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to