pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Euro not set in text field
Date Sat, 18 Apr 2015 15:38:55 GMT
Maybe try specifying the unicode value directly, like so:
test2.setValue("\u8364");

On Sat, Apr 18, 2015 at 12:57 PM, Frank Buss <fb@frank-buss.de> wrote:

> I have a PDF document with a text field and I want to enter an euro symbol
> (€) with a program, but I'll get a strange character (¬). This is the code:
>
> import java.io.*;
> import org.apache.pdfbox.pdmodel.*;
> import org.apache.pdfbox.pdmodel.interactive.form.*;
>
> public class PdfTest {
>
>         public static void main(final String args[]) throws Exception {
>                 // load test document
>                 PDDocument pdfDocument = PDDocument.load(new
> File("test.pdf"));
>                 PDDocumentCatalog docCatalog =
> pdfDocument.getDocumentCatalog();
>                 PDAcroForm acroForm = docCatalog.getAcroForm();
>
>                 // get test2 field and set Euro
>                 PDFieldTreeNode test2 = acroForm.getField("test2");
>                 test2.setValue("€");
>
>                 // save as new document
>                 pdfDocument.save("test2.pdf");
>                 pdfDocument.close();
>         }
> }
>
> See http://www.frank-buss.de/tmp/pdfTest.zip for the test.pdf and the
> generated test2.pdf. I'm using the latest snapshot
> (pdfbox-app-2.0.0-20150418.010411-1224.jar), but the same problem was in a
> snapshot from January, too. How can I solve the problem? I can try to fix
> it in the library, too, if someone can give me a hint where to search.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message