Using fonts in iText in Java

Creator QR Code 2d barcode in Java Using fonts in iText

Using fonts in iText
Encoding QR-Code In Java
Using Barcode generation for Java Control to generate, create QR-Code image in Java applications.
www.OnBarcode.com
Decoding QR Code In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
THE VERTICAL WRITING SYSTEM
Draw Code 39 Extended In Java
Using Barcode creator for Java Control to generate, create ANSI/AIM Code 39 image in Java applications.
www.OnBarcode.com
GS1 - 13 Drawer In Java
Using Barcode creation for Java Control to generate, create GTIN - 13 image in Java applications.
www.OnBarcode.com
In figure 11.7, some Asian movie titles were written from left to right, but some Eastern languages were originally written from top to bottom, in columns from right to left. See, for instance, figure 11.8. My knowledge of Japanese is limited to konishiwa and arigato, so I ve used the title of a movie by Akira Kurosawa and the English translation of a quote from this movie for this example. The PDF shown to the left in figure 11.8 is created using this code.
1D Encoder In Java
Using Barcode creation for Java Control to generate, create 1D image in Java applications.
www.OnBarcode.com
Generating Barcode In Java
Using Barcode maker for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
Figure 11.8 The vertical writing system
Barcode Maker In Java
Using Barcode creation for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
EAN - 14 Printer In Java
Using Barcode encoder for Java Control to generate, create UPC Case Code image in Java applications.
www.OnBarcode.com
Listing 11.9 VerticalTextExample1.java
QR Code Encoder In VS .NET
Using Barcode generator for ASP.NET Control to generate, create QR-Code image in ASP.NET applications.
www.OnBarcode.com
Make QR Code ISO/IEC18004 In None
Using Barcode creator for Online Control to generate, create QR Code 2d barcode image in Online applications.
www.OnBarcode.com
BaseFont bf = BaseFont.createFont( "KozMinPro-Regular", "UniJIS-UCS2-V", BaseFont.NOT_EMBEDDED); Font font = new Font(bf, 20); VerticalText vt = new VerticalText(writer.getDirectContent()); vt.setVerticalLayout(390, 570, 540, 12, 30); vt.addText(new Chunk(MOVIE, font)); vt.go(); vt.addText(new Phrase(TEXT1, font)); vt.go(); vt.setAlignment(Element.ALIGN_RIGHT); vt.addText(new Phrase(TEXT2, font)); vt.go();
Scanning Denso QR Bar Code In None
Using Barcode scanner for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
Create UPC-A Supplement 5 In None
Using Barcode drawer for Online Control to generate, create UPC A image in Online applications.
www.OnBarcode.com
Creates VerticalText Defines layout
Drawing European Article Number 13 In VS .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create GTIN - 13 image in Visual Studio .NET applications.
www.OnBarcode.com
QR Code ISO/IEC18004 Drawer In None
Using Barcode generation for Software Control to generate, create QR Code ISO/IEC18004 image in Software applications.
www.OnBarcode.com
You use the VerticalText object to achieve this. It s very similar to the ColumnText object, but instead of defining a simple column, you define a layout. The first two parameters define the coordinates where the column has to start, in this case (390, 570). The second parameter defines the height of each column: 540. Then follows the maximum number of lines that may be written (12) and the leading. Observe that the leading is no longer the vertical distance between two horizontal baselines, but the horizontal distance between two vertical lines. Likewise, you also have to turn your head 90 degrees to the right if you want to set the alignment: ALIGN_RIGHT aligns the column to the bottom. The PDF on the right in figure 11.8 is created in a slightly different way.
Generating Barcode In VS .NET
Using Barcode maker for Reporting Service Control to generate, create Barcode image in Reporting Service applications.
www.OnBarcode.com
Generating PDF417 In None
Using Barcode generator for Software Control to generate, create PDF 417 image in Software applications.
www.OnBarcode.com
Listing 11.10 VerticalTextExample2.java
Decode Code 128 Code Set A In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Recognizing PDF 417 In Visual C#.NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
public void createPdf(String filename) throws IOException, DocumentException { ... BaseFont bf = BaseFont.createFont(
Encoding Denso QR Bar Code In Java
Using Barcode generation for Eclipse BIRT Control to generate, create Denso QR Bar Code image in BIRT reports applications.
www.OnBarcode.com
Painting ECC200 In None
Using Barcode creation for Software Control to generate, create DataMatrix image in Software applications.
www.OnBarcode.com
Choosing the right font
"KozMinPro-Regular", "Identity-V", BaseFont.NOT_EMBEDDED); Font font = new Font(bf, 20); VerticalText vt = new VerticalText(writer.getDirectContent()); vt.setVerticalLayout(390, 570, 540, 12, 30); font = new Font(bf, 20); vt.addText(new Phrase(convertCIDs(TEXT1), font)); vt.go(); vt.setAlignment(Element.ALIGN_RIGHT); vt.addText(new Phrase(convertCIDs(TEXT2), font)); vt.go(); ... } public String convertCIDs(String text) { char cid[] = text.toCharArray(); for (int k = 0; k < cid.length; ++k) { char c = cid[k]; if (c == '\n') cid[k] = '\uff00'; else cid[k] = (char) (c - ' ' + 8720); } return new String(cid); }
You still use KozMinPro-Regular, but now you use Identity-V. This font contains Western characters that are rotated 90 degrees clockwise, as shown in figure 11.8. You use the custom-made formula in the convertCIDs() method to translate the normal characters into rotated characters. This example demonstrates more or less what needs to be done when you re confronted with Strings in different encodings.
USING OTHER CMAPS
The UCS2 in the CMap names listed in table 11.4 stands for Universal Character Set. There s also a JAR named iTextAsianCmaps.jar with the contents of the com/itextpdf/ text/pdf/cmaps/ directory. These CMaps can be used in combination with the PdfEncodings class to convert a String in a specific encoding to a String with 2-byte CIDs. For example, if you have a char[]encoded in the GB 18030-2000 character set, you need to load the CMap GBK2K-H and convert it to a sequence of Identity-H CIDs like this:
PdfEncodings.loadCmap("GBK2K-H", PdfEncodings.CRLF_CID_NEWLINE); byte text[] = my_GB_encoded_text; String cid = PdfEncodings.convertCmap("GBK2K-H", text); BaseFont bf = BaseFont.createFont( "STSong-Light", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); Paragraph p = new Paragraph(cid, new Font(bf, 14)); document.add(p);
We ve discussed Asian languages written vertically. Now let s find out how to write Semitic languages such as Hebrew and Arabic; these are written from right to left.
11.3.4 Writing from right to left
Figure 11.9 shows an XML file with the text Say Peace in all languages in English, Arabic, and Hebrew. The XML is encoded using UTF-8, and in the top left of the figure it s
Using fonts in iText
Writing from right to left
opened in WordPad, which assumes it s plain text, hence the strange characters. You ll use this XML file to create the PDF document shown in the foreground. But you ll start by creating the PDF showing the movie title Nina s Tragedies in Hebrew. Writing from right to left is only supported when using ColumnText or PdfPCell objects.
Copyright © OnBarcode.com . All rights reserved.