Project

General

Profile

Actions

Bug #1094

closed

WPdfRenderer and WString::fromUTF8....

Added by Łukasz Matuszewski about 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
12/12/2011
Due date:
% Done:

0%

Estimated time:

Description

I have string from database which is perfectly displayed in Wt page and is not perfectly displayed in PDF rendered by WPdfRenderer.

This string is: Michael Bublé.

I have attached pdf file for you to see (you must zoom hard to see).

HPDF_Doc pdf = HPDF_New(error_handler, 0);
 HPDF_Page page = HPDF_AddPage(pdf);
 HPDF_Page_SetSize(page, HPDF_PAGE_SIZE_A4, HPDF_PAGE_PORTRAIT);

 Render::WPdfRenderer renderer(pdf, page);
 renderer.setMargin(2.54);
 renderer.setDpi(96);

 renderer.render(WString::fromUTF8("<p style=\"background-color: #c11\">Michael Bublé</p>"));

 HPDF_SaveToFile(pdf, "hello.pdf");
 HPDF_Free(pdf);

Files

Vectors_of_params.pdf (2.33 KB) Vectors_of_params.pdf Łukasz Matuszewski, 12/12/2011 06:19 PM
test.pdf (155 KB) test.pdf Koen Deforche, 12/13/2011 11:10 AM
xhtml2pdf.cc (1.73 KB) xhtml2pdf.cc Koen Deforche, 12/13/2011 11:10 AM
Actions #1

Updated by Łukasz Matuszewski about 13 years ago

The pdf is created form string:

<table style="font-size: 3mm"><tr style="font-weight: bold"><td style="border: 1px solid black;">Artist name</td><td style="border: 1px solid black;">TC</td></tr><tr><td style="border: 1px solid black;">Michael Bublé</td><td style="border: 1px solid black;">15,836534</td></tr></table>

And the log is:

[2011-Dec-12 18:18:10.381710] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.383605] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.387312] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.407961] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.408934] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.410892] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.411007] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Bubl?"
[2011-Dec-12 18:18:10.411230] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Bubl?"
[2011-Dec-12 18:18:10.413470] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.415260] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.427033] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.438030] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.438890] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.443380] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.447488] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: blue(): color component not available."
[2011-Dec-12 18:18:10.447567] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: green(): color component not available."
[2011-Dec-12 18:18:10.447605] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: red(): color component not available."
[2011-Dec-12 18:18:10.449926] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.451504] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: blue(): color component not available."
[2011-Dec-12 18:18:10.451570] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: green(): color component not available."
[2011-Dec-12 18:18:10.451609] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: red(): color component not available."
[2011-Dec-12 18:18:10.453394] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: blue(): color component not available."
[2011-Dec-12 18:18:10.453448] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: green(): color component not available."
[2011-Dec-12 18:18:10.453484] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: red(): color component not available."
[2011-Dec-12 18:18:10.455640] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "HPDF_New error: 4139 0"
[2011-Dec-12 18:18:10.456135] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [warning] "WString: narrow(): loss of detail: Michael Bubl?"
[2011-Dec-12 18:18:10.457280] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: blue(): color component not available."
[2011-Dec-12 18:18:10.457369] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: green(): color component not available."
[2011-Dec-12 18:18:10.457408] 19507 [/wt/SyNaTPG.wt 6t4WjGin9aZFOdCp] [error] "WColor: red(): color component not available."
127.0.0.1 - - [2011-Dec-12 18:18:10.460121] "GET /wt/SyNaTPG.wt/Wektory_parametrow.pdf?wtd=6t4WjGin9aZFOdCp&request=resource&resource=ojraca6&rand=186 HTTP/1.1" 200 2391
[2011-Dec-12 18:18:10.471305] 19507 - [info] "WebRequest: took 532.721ms"
[2011-Dec-12 18:19:37.244818] 19507 - [info] "WServer/wthttp: shutdown (signal = 2)"
[2011-Dec-12 18:19:37.244993] 19507 - [info] "WebController: shutdown: stopping sessions."

There is lot of errors like: WColor: red(): color component not available.

BR,

Luke

Actions #2

Updated by Łukasz Matuszewski about 13 years ago

Sorry, my mistake - YOU CAN NOT USE NAMED COLORS IN STYLES. I have fixed that, but [warning] "WString: narrow(): loss of detail: Michael Bubl?" still persist. Or am i doing something terribly wrong ?

BR,

Luke

Updated by Koen Deforche about 13 years ago

Hey,

Please find in attachment the output that I get (which seems correct). But I realize that you need to setup libharu to accept UTF-8 encoded strings, which is not documented well.

See attached xhtml2pdf.cc which converts a html fragment into a pdf.

Regards,

koen

Actions #4

Updated by Łukasz Matuszewski about 13 years ago

Thanks, you solution just works.

BR,

Luke

Actions #5

Updated by Koen Deforche about 13 years ago

  • Status changed from Feedback to Resolved
Actions #6

Updated by Koen Deforche over 12 years ago

  • Status changed from Resolved to Closed
  • Target version set to 3.2.1
Actions

Also available in: Atom PDF