During our test porting an existing application that uses iTextSharp to Mono we
found out that creating a PDF file from HTML (using the ParseXHtml method from
the class XMLWorkerHelper) fails. We debugged our software first but the source
of the error was during the registration of the path of the fonts
(core/iTextSharp/text/FontFactoryImp.cs). One of my colleagues used your
library with Mono so we reviewed the changes to that particular file and
discovered that one change was made to the file (quite a while ago to be
honest, in 2010) that changed the behavior of the library on Mono (mainly
because of how Mono handles the special folders that cannot be mapped directly
to the Linux equivalent). We made a patch for it (the one I'm sending with this
e-mail, a diff between the version of the file in your repository and the
patched file) using the old version of the file for reference and it works as
intended with Mono without repercussions on the behavior with Windows (since we
use your library under Windows too).
--
Francesco Biondi
Software Engineer
Fairmat Srl
Str.ne San Fermo 21
37121 Verona
Tel. +39 045 8012030
Fax. + 39 045 8011204
P.IVA 03754840233
--- FontFactoryImp.cs 2013-09-03 15:35:28.410523700 +0200
+++ FontFactoryImp.PatchMono.cs 2013-09-03 16:25:26.864692600 +0200
@@ -527,6 +527,25 @@
* @return the number of fonts registered
*/
public virtual int RegisterDirectories() {
+ if (Environment.OSVersion.Platform == PlatformID.Unix ||
+ Environment.OSVersion.Platform == PlatformID.MacOSX)
+ {
+ // Use paths specific to Linux and MacOSX
+ int count = 0;
+
+ // Linux
+ count += RegisterDirectory("/usr/share/X11/fonts", true);
+ count += RegisterDirectory("/usr/X/lib/X11/fonts", true);
+ count += RegisterDirectory("/usr/openwin/lib/X11/fonts", true);
+ count += RegisterDirectory("/usr/share/fonts", true);
+ count += RegisterDirectory("/usr/X11R6/lib/X11/fonts", true);
+
+ // MacOSX
+ count += RegisterDirectory("/Library/Fonts");
+ count += RegisterDirectory("/System/Library/Fonts");
+ return count;
+ }
+
string dir =
Path.Combine(Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.System)),
"Fonts");
return RegisterDirectory(dir);
}
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php