Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / HTML2PDF | Not successful at setting active font..
Author Message
zooz
Member
# Posted: 18 Oct 2008 10:20 · Edited by: zooz


The following line of code...
PDF.PDFPAGE_SetActiveFont(PDF.AddTTFFontFromFile2( "Arial"), false, false, false, false, 10.0, TxFontCharset.charsetHEBREW_CHARSET);
Simply dosn't change anything in the PDF document... (no errors, everything works as expected) It just has no effect... I still see question marks instead of Hebrew... what's the deal?


-----

Here's my example:

PDFDocument3 PDF = new PDFDocument3();
PDF.StartEngine("demo@demo", "demo"); // initialize PDF Engine
PDF.AutoLaunch = true; // set AutoLaunch flag to TRUE to automatically open the generated pdf generation
PDF.FileName = @"WebApplication2PDFsHTMLstringWithExternalImageTo PDF_VBS.pdf";
PDF.BeginDoc(); // start document generation
PDF.PDFPAGE_SetActiveFont(PDF.AddTTFFontFromFile(" Arial", TxFontCharset.charsetHEBREW_CHARSET), false, false, false, false, 10.0, TxFontCharset.charsetHEBREW_CHARSET);
HTML2PDF2 HTML = new HTML2PDF2();
HTML.StartHTMLEngine("", ""); // initialize HTML engine
HTML.ConnectToPDFLibrary(PDF); // connect to PDF Creator Pilot instance
// load HTML string with external image
HTML.LoadHTMLString("<html><body><br><br><br>Hello :<br>שלום<br></body></html>", "");
HTML.ConvertAll(); // convert whole HTML document into PDF
HTML.DisconnectFromPDFLibrary(); // disconnect from PDF Creator Pilot instance
HTML = null;
PDF.EndDoc(); // finalize PDF generation

max.f
# Posted: 19 Oct 2008 22:31


Hello,
PDFPAGE_SetActiveFont changes current font in PDF page for manual PDF page rendering. That means it will affect any text output if you call them manualy with PDFPAGE_TextOut or PDFPAGE_TextShow (or any other) method. Calling PDFPAGE_SetActiveFont method will not affect any text if it is a result of an HTML conversion.
If you wand to change font in the PDF document that is a result of the HTML conversion then you need to change HTML source. That means, if you need Hebrew chars then just enter your HTML string (or file) as an UTF-8 or UNICODE or add
<meta http-equiv="Content-Type" content="text/html; charset=*** " />
(with a proper charset) in your HTML.

--
Max Filimonov

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.013

 

Page top