You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2016/09/05 16:20:21 UTC

[jira] [Resolved] (PDFBOX-3481) Localization in XRef generation results in unusable PDFs

     [ https://issues.apache.org/jira/browse/PDFBOX-3481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr resolved PDFBOX-3481.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.1.0
                   2.0.3
                   1.8.13

Setting to resolved. The best would be that you try building from source in your "special" environment, to see if there are other problems. Even if it works, be aware that PDFBox doesn't support RTL script.

> Localization in XRef generation results in unusable PDFs
> --------------------------------------------------------
>
>                 Key: PDFBOX-3481
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3481
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.8.12, 1.8.13, 2.0.2, 2.0.3, 2.1.0
>            Reporter: Edward Kupershlak
>            Assignee: Tilman Hausherr
>              Labels: easyfix, locale, newbie, patch
>             Fix For: 1.8.13, 2.0.3, 2.1.0
>
>         Attachments: xref_format.patch
>
>
> PDFBox appears to be using a localized number formatter when encoding the XRef table. Depending on locale settings, this can result in unicode characters being used, which prevents PDFBox from loading the PDF.
> The following code demonstrates this:
> {code}
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.FileOutputStream;
> import java.util.Locale;
> import org.apache.pdfbox.pdmodel.PDDocument;
> import org.apache.pdfbox.pdmodel.PDPage;
> import org.apache.pdfbox.pdmodel.common.PDRectangle;
> class Example {
>   public static void main(String [] args) throws Exception {
>     File tempFile = File.createTempFile("example", ".pdf");
>     Locale arabicLocale = new Locale.Builder().setLanguageTag("ar-EG-u-nu-arab").build();
>     Locale.setDefault(arabicLocale);
>     try (FileOutputStream out = new FileOutputStream(tempFile)) {
>       PDDocument doc = new PDDocument();
>       doc.addPage(new PDPage(PDRectangle.LETTER));
>       doc.save(out);
>       doc.close();
>     }
>     try (FileInputStream in = new FileInputStream(tempFile)) {
>       PDDocument doc = PDDocument.load(in);
>       // This will throw.
>       doc.getPage(0);
>     }
>   }
> }
> {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