You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Omid Pourhadi (JIRA)" <ji...@apache.org> on 2016/11/01 06:36:59 UTC
[jira] [Updated] (PDFBOX-3550) Unicode Letters fail to join
[ https://issues.apache.org/jira/browse/PDFBOX-3550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Omid Pourhadi updated PDFBOX-3550:
----------------------------------
Description:
the problem is, in some languages letters need to join together for example, consider this word
{color:red}
سلام
{color}
but after creating a pdf it contorts to
{color:red}
سلام
{color}
with extra semi-spaces. I think this is a bug in pdfbox and definetly is not related to font.
{code:title=SampleCode.java|borderStyle=solid}
public class SampleCode
{
public static void main(String[] args) throws IOException
{
PDDocument document = new PDDocument();
//this font perfectly works in iText and JasperReport with the same text
PDFont titleFont = PDType0Font.load(document, SimpleUsage.class.getResourceAsStream("/BYekan.ttf"));
PDPage page = new PDPage(PDRectangle.A4);
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document, page);
contentStream.beginText();
contentStream.setFont(titleFont, 12);
contentStream.newLineAtOffset(0, 100);
contentStream.showText("سلام");
contentStream.endText();
contentStream.close();
document.save(new File("/home/omidp/temp/htmltopdf/output.pdf"));
document.close();
}
}
{code}
was:
the problem is, in some languages letters need to join together for example, consider this word
{color:red}
سلام
{color}
but after creating a pdf it contorts to
*سلام*
with extra semi-spaces. I think this is a bug in pdfbox and definetly is not related to font.
{code:title=SampleCode.java|borderStyle=solid}
public class SampleCode
{
public static void main(String[] args) throws IOException
{
PDDocument document = new PDDocument();
//this font perfectly works in iText and JasperReport with the same text
PDFont titleFont = PDType0Font.load(document, SimpleUsage.class.getResourceAsStream("/BYekan.ttf"));
PDPage page = new PDPage(PDRectangle.A4);
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document, page);
contentStream.beginText();
contentStream.setFont(titleFont, 12);
contentStream.newLineAtOffset(0, 100);
contentStream.showText("سلام");
contentStream.endText();
contentStream.close();
document.save(new File("/home/omidp/temp/htmltopdf/output.pdf"));
document.close();
}
}
{code}
> Unicode Letters fail to join
> ----------------------------
>
> Key: PDFBOX-3550
> URL: https://issues.apache.org/jira/browse/PDFBOX-3550
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel, Rendering
> Environment: All
> Reporter: Omid Pourhadi
> Labels: unicode
>
> the problem is, in some languages letters need to join together for example, consider this word
> {color:red}
> سلام
> {color}
> but after creating a pdf it contorts to
> {color:red}
> سلام
> {color}
> with extra semi-spaces. I think this is a bug in pdfbox and definetly is not related to font.
> {code:title=SampleCode.java|borderStyle=solid}
> public class SampleCode
> {
> public static void main(String[] args) throws IOException
> {
>
> PDDocument document = new PDDocument();
> //this font perfectly works in iText and JasperReport with the same text
> PDFont titleFont = PDType0Font.load(document, SimpleUsage.class.getResourceAsStream("/BYekan.ttf"));
> PDPage page = new PDPage(PDRectangle.A4);
> document.addPage(page);
> PDPageContentStream contentStream = new PDPageContentStream(document, page);
> contentStream.beginText();
> contentStream.setFont(titleFont, 12);
> contentStream.newLineAtOffset(0, 100);
> contentStream.showText("سلام");
> contentStream.endText();
> contentStream.close();
>
>
> document.save(new File("/home/omidp/temp/htmltopdf/output.pdf"));
> document.close();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org