[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15530033#comment-15530033 ] Tilman Hausherr commented on PDFBOX-3504: - Sorry, I don't understand what you mean with "to custom this font file for above fonts". You shouldn't post to this issue anymore, it isn't made for "how to" questions. These are for the mailing list https://mail-archives.apache.org/mod_mbox/pdfbox-users/ or stackoverflow. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Fix For: 2.0.4, 2.1.0 > > Attachments: NexusSansOffcPro.ttf > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15530001#comment-15530001 ] KUMARA SWAMY PALLUKURI commented on PDFBOX-3504: Thanks for your patience and help One final question This is expected font NexusSansOffcPro needed in my project, Is there any chance to custom this font file for above fonts any solution will be great,please go thourgh attached font file. let me know if any thing required. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15526595#comment-15526595 ] Tilman Hausherr commented on PDFBOX-3504: - You need to use arialuni.ttf, not arial.ttf. If you're on windows, look at your fonts with charmap.exe. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15526360#comment-15526360 ] KUMARA SWAMY PALLUKURI commented on PDFBOX-3504: Hi Team, I added Chinese ,Japanese font in the below program, am getting below exception Please help me on this... import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDPageContentStream; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType0Font; import org.apache.pdfbox.pdmodel.font.PDType1Font; public class SimpleTest { public static void main(String[] args) throws Exception { SimpleTest s = new SimpleTest(); s.pdfGeneration(); } public void pdfGeneration() throws IOException { String outputFileName = "Simple123.pdf"; // Create a document and add a page to it PDDocument document = new PDDocument(); PDPage page1 = new PDPage(PDRectangle.A4); // PDRectangle.LETTER and others are also possible PDRectangle rect = page1.getMediaBox(); // rect can be used to get the page width and height document.addPage(page1); // Create a new font object selecting one of the PDF base fonts PDFont fontPlain = PDType1Font.HELVETICA; PDFont fontBold = PDType1Font.HELVETICA_BOLD; PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; PDFont fontMono = PDType1Font.COURIER; // Start a new content stream which will "hold" the to be created // content PDPageContentStream cos = new PDPageContentStream(document, page1); PDType0Font font = PDType0Font.load(document, new File("c:/windows/fonts/arial.ttf")); // stream.setFont(font, 12); // stream.showText("α"); int line = 0; List sampleData = new ArrayList(); sampleData.add("ss1 s"); sampleData.add("dd α"); sampleData.add("日本語に切り替える"); sampleData.add("切换到简体中文"); sampleData.add("查看繁體中文版本"); // String tt ="sss"; for (String tt : sampleData) { ++line; //drawText(cos, fontPlain, tt, rect, line); cos.beginText(); cos.setFont(font, 12); cos.newLineAtOffset(100, rect.getHeight() - 50 * (line)); cos.showText(tt); cos.endText(); } cos.close(); document.save(outputFileName); document.close(); } public void drawText(PDPageContentStream cos, PDFont fontPlain,String text, PDRectangle rect, int line) throws IOException { try { cos.beginText(); cos.setFont(fontPlain, 12); cos.newLineAtOffset(100, rect.getHeight() - 50 * (line)); cos.showText(text); cos.endText(); } catch (Exception e) { e.printStackTrace(); // cos.endText(); } } } Exception: Exception in thread "main" java.lang.IllegalArgumentException: No glyph for U+65E5 in font ArialMT at org.apache.pdfbox.pdmodel.font.PDCIDFontType2.encode(PDCIDFontType2.java:411) at org.apache.pdfbox.pdmodel.font.PDType0Font.encode(PDType0Font.java:351) at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) at org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) at com.test.SimpleTest.pdfGeneration(SimpleTest.java:61) at com.test.SimpleTest.main(SimpleTest.java:20) > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15507359#comment-15507359 ] John Hewson commented on PDFBOX-3504: - We support any language which doesn't require [complex text layout|https://en.wikipedia.org/wiki/Complex_text_layout]. The supported characters are determined by the font, not by PDFBox, so you'll have to inspect the fonts on your system. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15507054#comment-15507054 ] Tilman Hausherr commented on PDFBOX-3504: - Sorry, but that is your job as developer. You know on what type of systems your application will run, so you need to find out what fonts there are. If it will run on many systems, then you may have to distribute one or many fonts. On windows, arialuni.ttf can do western, chinese and japanese and arabic glyphs but I don't know about others, nor do I know if this font is available on non windows systems or on other windows than W7. On windows, you can have a look on fonts with charmap.exe. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15506517#comment-15506517 ] KUMARA SWAMY PALLUKURI commented on PDFBOX-3504: Am actually going to implement web application, so in server path, I place above font file, if possible list me all supported font files which will support for special characters and for different languages... > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Labels: newbie > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504739#comment-15504739 ] Tilman Hausherr commented on PDFBOX-3504: - This depends of your OS. You need to find the application that shows what fonts are available. In Windows, it is in the control panel, "fonts". > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Labels: newbie > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504732#comment-15504732 ] KUMARA SWAMY PALLUKURI commented on PDFBOX-3504: Thanks a lot for reply,is there any font files available like this > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0, 2.0.3, 2.1.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI >Assignee: Tilman Hausherr > Labels: newbie > Fix For: 2.0.4, 2.1.0 > > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504427#comment-15504427 ] ASF subversion and git services commented on PDFBOX-3504: - Commit 1761490 from [~tilman] in branch 'pdfbox/branches/2.0' [ https://svn.apache.org/r1761490 ] PDFBOX-3504: add Symbol encoding for PDType1Font.SYMBOL > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI > Labels: newbie > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504401#comment-15504401 ] ASF subversion and git services commented on PDFBOX-3504: - Commit 1761489 from [~tilman] in branch 'pdfbox/trunk' [ https://svn.apache.org/r1761489 ] PDFBOX-3504: add Symbol encoding for PDType1Font.SYMBOL > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI > Labels: newbie > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504212#comment-15504212 ] Tilman Hausherr commented on PDFBOX-3504: - You can use the code above for japanese, chinese, russian and many other fonts. What doesn't work properly is RTL fonts (hebrew, arabic) and fonts where there is replacement of glyphs, e.g. Thai. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI > Labels: newbie > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504173#comment-15504173 ] KUMARA SWAMY PALLUKURI commented on PDFBOX-3504: Is it possible to support multi languages with same font file like japanese ,chinese... etc. > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI > Labels: newbie > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504172#comment-15504172 ] Tilman Hausherr commented on PDFBOX-3504: - Code that fails: {code} PDFont font = PDType1Font.SYMBOL; stream.setFont(font, 12); stream.showText("α"); Exception in thread "main" java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this font Symbol (generic: SymbolMT) encoding: WinAnsiEncoding at org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:400) at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:316) at org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:362) {code} Doesn't seem right that WinAnsiEncoding is used for the SYMBOL font. Probably similar problem than we had for the ZAPF_DINGBATS font (PDFBOX-3298). > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI > Labels: newbie > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail:
[jira] [Commented] (PDFBOX-3504) Special characters issue
[ https://issues.apache.org/jira/browse/PDFBOX-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15504153#comment-15504153 ] Tilman Hausherr commented on PDFBOX-3504: - The problem is that the alpha is not part of the "Latin Character Set and Encodings" set that is used for HELVETICA glyphs. This code works: {code} PDType0Font font5 = PDType0Font.load(document, new File("c:/windows/fonts/arial.ttf")); stream.setFont(font5, 12); stream.newLine(); stream.showText("α"); {code} However you may have found a bug anyway. "Alpha" is part of the "Symbol Set and Encoding" that is used for the SYMBOL font, but I didn't get that to work. So I won't close this for now :-) > Special characters issue > > > Key: PDFBOX-3504 > URL: https://issues.apache.org/jira/browse/PDFBOX-3504 > Project: PDFBox > Issue Type: Bug > Components: FontBox >Affects Versions: 2.0.0 > Environment: Test >Reporter: KUMARA SWAMY PALLUKURI > Labels: newbie > > special characters are not supporting in my program > eg: "α"(alpha) > My sample code: > {code} > package com.test; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.PDPage; > import org.apache.pdfbox.pdmodel.PDPageContentStream; > import org.apache.pdfbox.pdmodel.common.PDRectangle; > import org.apache.pdfbox.pdmodel.font.PDFont; > import org.apache.pdfbox.pdmodel.font.PDType1Font; > public class SimpleTest { > public static void main(String[] args) throws Exception { > SimpleTest s = new SimpleTest(); > s.pdfGeneration(); > } > public void pdfGeneration() throws IOException { > String outputFileName = "Simple123.pdf"; > // Create a document and add a page to it > PDDocument document = new PDDocument(); > PDPage page1 = new PDPage(PDRectangle.A4); > // PDRectangle.LETTER and others are also possible > PDRectangle rect = page1.getMediaBox(); > // rect can be used to get the page width and height > document.addPage(page1); > // Create a new font object selecting one of the PDF base fonts > PDFont fontPlain = PDType1Font.HELVETICA; > PDFont fontBold = PDType1Font.HELVETICA_BOLD; > PDFont fontItalic = PDType1Font.HELVETICA_OBLIQUE; > PDFont fontMono = PDType1Font.COURIER; > // Start a new content stream which will "hold" the to be > created > // content > PDPageContentStream cos = new PDPageContentStream(document, > page1); > int line = 0; > List sampleData = new ArrayList(); > sampleData.add("ss1 s"); > sampleData.add("dd α"); > // String tt ="sss"; > for (String tt : sampleData) { > ++line; > drawText(cos, fontPlain, tt, rect, line); > } > cos.close(); > document.save(outputFileName); > document.close(); > } > public void drawText(PDPageContentStream cos, PDFont fontPlain,String > text, > PDRectangle rect, int line) throws IOException { > try { > cos.beginText(); > cos.setFont(fontPlain, 12); > cos.newLineAtOffset(100, rect.getHeight() - 50 * > (line)); > cos.showText(text); > cos.endText(); > } catch (Exception e) { > e.printStackTrace(); > // cos.endText(); > } > } > } > {code} > Exception: > {code} > java.lang.IllegalArgumentException: U+03B1 ('alpha') is not available in this > font's encoding: WinAnsiEncoding > at > org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:345) > at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286) > at > org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:411) > at com.test.SimpleTest.drawText(SimpleTest.java:67) > at com.test.SimpleTest.pdfGeneration(SimpleTest.java:50) > at com.test.SimpleTest.main(SimpleTest.java:18) > {code} > And also please let me know whether pdf box will supports for localization or > not? -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org