-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some tests and docs on dealing with exotic chars.
- Loading branch information
Showing
6 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3c.org/1999/xhtml" xml:lang="pl" lang="pl"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<title> Osobowość </title> | ||
<style type="text/css" > | ||
@font-face { | ||
src: url(http://localhost:8080/grails-rendering/fonts/arial.ttf); | ||
-fs-pdf-font-embed: embed; | ||
-fs-pdf-font-encoding: cp1250; | ||
} | ||
@page { | ||
size: 210mm 297mm; | ||
} | ||
body { | ||
font-weight: bold; | ||
font-family: "Arial Unicode MS", Arial, sans-serif; | ||
font-size:18px; | ||
width: 400px; | ||
color: black; | ||
background-color: white; | ||
margin: 0px; | ||
padding-top: 0px; | ||
text-align: center; | ||
} | ||
p { | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p id="wnioskodawca"> | ||
¨ü¨¨ü¨¨ü¨¨üüøo łłłłłasdfasdfłłł | ||
Numer Identyfikacyjny: | ||
Nazwa / Nazwisko: | ||
Pierwsze Imię: | ||
Drugie Imię: | ||
Obywatelstwo: | ||
Płeć: | ||
Data Urodzenia: | ||
PESEL: | ||
REGON: | ||
Dowód tożsamości: | ||
NIP: | ||
KRS: | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
In most cases, there are no issues with dealing with exotic Unicode characters. However, certain characters will not render in PDF documents without some extra work (the same problem does not exist when rendering images). This is a quirk with the way iText works, which is the library underpinning the PDF generation. | ||
|
||
This "thread":http://www.mail-archive.com/itext-questions@lists.sourceforge.net/msg48788.html explains the issue. | ||
|
||
The solution is to register the font to use with a particular encoding. Because we are using XHTMLRenderer we can specify this in CSS as opposed to programatically registering. | ||
|
||
{code} | ||
@font-face { | ||
src: url(path/to/arial.ttf); | ||
-fs-pdf-font-embed: embed; | ||
-fs-pdf-font-encoding: cp1250; | ||
} | ||
body { | ||
font-family: "Arial Unicode MS", Arial, sans-serif; | ||
} | ||
{code} | ||
|
||
See "this page":http://pigeonholdings.com/projects/flyingsaucer/R8/doc/guide/users-guide-R8.html#xil_44 for details on these CSS directives. |
Binary file not shown.