Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » PDF Export With Chinese Character[SOLVED]
PDF Export With Chinese Character[SOLVED] [message #22788] Sat, 15 August 2009 15:35 Go to next message
kasome is currently offline  kasome
Messages: 78
Registered: July 2008
Location: Taiwan
Member
I try to use Report package to export pdf file with Chinese character, and here is the content of my test case.
#include <Report/Report.h>

using namespace Upp;

GUI_APP_MAIN
{
	Report r;
	r.Header("[A2> Page $$P");
	r << "This is some [* QTF text";
	r << t_("顯示[* QTF 文字");
	r << "&&Let's report some table:";
	r << t_("輸出表格式報表:");
	String tab;
	tab << "{{1:1:1:1:1:1:2 A:: B:: C:: D:: E:: F:: G (wider)";
	for(int row = 0; row < 20; row++)
		for(int column = 0; column < 7; column++)
			tab << ":: " << row << ":" << column << t_("測試");
	r << tab;
	
	r.NewPage();
	int y = r.GetY();
	r.DrawEllipse(300, y + 50, 3000, 2000, LtRed, 20);
	r.DrawText(500, y + 50 + 950, "Some free drawing in this page!", Arial(100));
	r.DrawText(500, y + 50 + 1100, t_("在這頁隨便畫一些東西!"), Arial(100));
	r.SetY(y + 50 + 3000);
	r << "More of [/ QTF] [C6* text";
	
	Perform(r);
}



The Report package works no problem on Chinese character, but when i push the "PDF export.." Button,it outputs an empty pdf file and with the file size 0kb.
index.php?t=getfile&id=1884&private=0


index.php?t=getfile&id=1885&private=0

I already put the test case as file Attachments,could someone help?

[Updated on: Sat, 22 August 2009 09:25]

Report message to a moderator

Re: PDF Export With Chinese Character [message #22805 is a reply to message #22788] Mon, 17 August 2009 20:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, it works for me.

Anyway, there is a tricky problem with your testcase. PdfDraw package is only included conditionally by Draw and (as it was in my case), it does not really gets included into Report.

I have to admit I am surprised that you have the PDF Export button in Report - I did not.

After fixing this issue, everything works as expected.

Mirek
Re: PDF Export With Chinese Character [message #22848 is a reply to message #22805] Sat, 22 August 2009 09:34 Go to previous messageGo to next message
kasome is currently offline  kasome
Messages: 78
Registered: July 2008
Location: Taiwan
Member
I see. Smile Thanks, Mirek.
Re: PDF Export With Chinese Character [message #22930 is a reply to message #22848] Sat, 29 August 2009 18:11 Go to previous messageGo to next message
kasome is currently offline  kasome
Messages: 78
Registered: July 2008
Location: Taiwan
Member
Sorry to bother you again. Smile

After adding PdfDraw into Report, now i can export the pdf file correctly.

But i found it will be fail to export pdf file on some computer without installing the font "Arial Unicode MS", so i have to install the font "Arial Unicode MS" on these computers to make it work.

Is there better way?

You can test just by backup the file of the font "Arial Unicode MS" (e.g.ARIALUNI.TTF) first, and then delete it to see whether or not to export pdf file correctly?


ps: My OS is Windows XP SP2.

[Updated on: Sat, 29 August 2009 18:12]

Report message to a moderator

Re: PDF Export With Chinese Character [message #22999 is a reply to message #22930] Sat, 05 September 2009 08:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kasome wrote on Sat, 29 August 2009 12:11

Sorry to bother you again. Smile

After adding PdfDraw into Report, now i can export the pdf file correctly.

But i found it will be fail to export pdf file on some computer without installing the font "Arial Unicode MS", so i have to install the font "Arial Unicode MS" on these computers to make it work.

Is there better way?

You can test just by backup the file of the font "Arial Unicode MS" (e.g.ARIALUNI.TTF) first, and then delete it to see whether or not to export pdf file correctly?


ps: My OS is Windows XP SP2.


Well, Arial Unicode contains chinesse glyphs, that is why it was choosen as replacement font. I was not really aware that it is not widely supported.

Remedy is quite simple: In Draw/FontCR.cpp there is

sFontReplacements

table. What we need is to identify some fonts on computers without Arial Unicode that contain glyphs you need.

One problem: Adding too many fonts into the table makes things slow (OTOH, adding fonts that are not present on computer is not a problem).

Mirek
Re: PDF Export With Chinese Character [message #23000 is a reply to message #22999] Sat, 05 September 2009 08:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
luzr wrote on Sat, 05 September 2009 02:35

kasome wrote on Sat, 29 August 2009 12:11

Sorry to bother you again. Smile

After adding PdfDraw into Report, now i can export the pdf file correctly.

But i found it will be fail to export pdf file on some computer without installing the font "Arial Unicode MS", so i have to install the font "Arial Unicode MS" on these computers to make it work.

Is there better way?

You can test just by backup the file of the font "Arial Unicode MS" (e.g.ARIALUNI.TTF) first, and then delete it to see whether or not to export pdf file correctly?


ps: My OS is Windows XP SP2.


Well, Arial Unicode contains chinesse glyphs, that is why it was choosen as replacement font. I was not really aware that it is not widely supported.

Remedy is quite simple: In Draw/FontCR.cpp there is

sFontReplacements



(Of course, after you do, post it here as patch... Smile
Re: PDF Export With Chinese Character[SOLVED] [message #27325 is a reply to message #22788] Mon, 12 July 2010 14:16 Go to previous messageGo to next message
bubo is currently offline  bubo
Messages: 6
Registered: July 2009
Promising Member
Can be such font inserted (and used) to resulting pdf file?
Re: PDF Export With Chinese Character[SOLVED] [message #27424 is a reply to message #27325] Sat, 17 July 2010 10:00 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
bubo wrote on Mon, 12 July 2010 08:16

Can be such font inserted (and used) to resulting pdf file?


All used fonts (or more specifically, individual glyphs) are always embedded into resulting pdf by default.
Previous Topic: Using QTF the easiest way (specially for Newbies)
Next Topic: HTML to QTF
Goto Forum:
  


Current Time: Thu Mar 28 18:43:29 CET 2024

Total time taken to generate the page: 0.01224 seconds