Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How birt handles Khmer text( Birt can render PDFs containing Khmer text, but it looks like garbled characters)
How birt handles Khmer text [message #1828716] Wed, 17 June 2020 13:38 Go to next message
Yao Zeng is currently offline Yao ZengFriend
Messages: 1
Registered: June 2020
Junior Member
design:
<body>
        <label id="5">
            <property name="fontFamily">"Khmer UI"</property>
            <text-property name="text">សាធារណរដ្ឋប្រជាមានិតប្រជាធិបតេយ្យកូរ៉េ</text-property>
        </label>
        <label id="7">
            <property name="fontFamily">"Khmer OS"</property>
            <text-property name="text">សាធារណរដ្ឋប្រជាមានិតប្រជាធិបតេយ្យកូរ៉េ</text-property>
        </label>
    </body>


java:
public static void main(String[] args) throws EngineException {
		EngineConfig config = new EngineConfig( );
		config.setEngineHome( "put engine path here" );
		IReportEngine engine = null;
		
		try{
			 config = new EngineConfig( );
				//delete the following line if using BIRT 3.7 (or later) POJO runtime
				//As of 3.7.2, BIRT now provides an OSGi and a POJO Runtime.
			
				config.setEngineHome( "E:\\bak\\birt-report-designer-all-in-one-4.8.0-20180626-win32.win32.x86_64\\eclipse\\workspace\\printTest\\ReportEngine" );
				//config.setLogConfig(c:/temp, Level.FINE);
				Platform.startup( config );
				//If using RE API in Eclipse/RCP application this is not needed.
				IReportEngineFactory factory = (IReportEngineFactory) Platform
						.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
				engine = factory.createReportEngine( config );
				engine.changeLogLevel( Level.WARNING );
			}catch( Exception ex){
				ex.printStackTrace();
			}
		
		IReportRunnable design = engine.openReportDesign("E:\\bak\\birt-report-designer-all-in-one-4.8.0-20180626-win32.win32.x86_64\\eclipse\\workspace\\printTest\\src\\zeng\\khmer.rptdesign"); 
		
		//Create task to run and render the report,
		IRunAndRenderTask task = engine.createRunAndRenderTask(design);
		
		//Set parent classloader for engine
		task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, 
				PrintTest.class.getClassLoader()); 
		
		//Setup rendering to HTML
		IRenderOption options = new RenderOption();		
		options.setOutputFormat("pdf");
		options.setOutputFileName("khmer.pdf");
		
		PDFRenderOption pdfOptions = new PDFRenderOption( options );
		pdfOptions.setOption(IPDFRenderOption.PDF_FONT_SUBSTITUTION,"");
		//Setting this to true removes html and body tags
		//options.setEmbeddable(false);
		task.setRenderOption(options);
		//run and render report
		task.run();
		task.close();
		
	}



It works, but it looks garbled, how do I deal with Khmer??
  • Attachment: khmer.pdf
    (Size: 16.04KB, Downloaded 92 times)
Re: How birt handles Khmer text [message #1828756 is a reply to message #1828716] Thu, 18 June 2020 06:55 Go to previous message
Roei Hanuka is currently offline Roei HanukaFriend
Messages: 2
Registered: June 2020
Junior Member
Hey, did you manage to work it out? I'm facing the same problem with Hebrew.
Previous Topic:Replace zero values with a custom string in a table with aggregated values ...
Next Topic:Unable to set character encoding for URL parameters for report
Goto Forum:
  


Current Time: Fri Apr 26 12:31:31 GMT 2024

Powered by FUDForum. Page generated in 0.03081 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top