[ 
https://issues.apache.org/jira/browse/PDFBOX-5512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17603099#comment-17603099
 ] 

Maruan Sahyoun commented on PDFBOX-5512:
----------------------------------------

works fine for me - sure that you are setting using "Universität"
{code:java}
    @Test
    public void testPDFBox5512() throws IOException
    {
        String sourceUrl = 
"https://issues.apache.org/jira/secure/attachment/13049176/Unfallmeldung_Bildungseinrichtungen_bf_01-2020.pdf";;

        PDDocument testPdf = null;
        try 
        {
            testPdf = PDDocument.load(new URL(sourceUrl).openStream());
            PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm();
            PDRadioButton field = (PDRadioButton) acroForm.getField("Art der 
Bildungseinrichtung");
            // print the potential values to set the different options
            System.out.println(field.getOnValues());
            field.setValue("Universität");
            
testPdf.save("Unfallmeldung_Bildungseinrichtungen_bf_01-2020-filled.pdf");
        }
        finally
        {
            IOUtils.closeQuietly(testPdf);
        }
    }
{code}

> PDRadioButton.setValue(..) does not work for non-ASCII values
> -------------------------------------------------------------
>
>                 Key: PDFBOX-5512
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5512
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.26
>         Environment: OpenJDK 8/Linux/x64, probably irrelevant
>            Reporter: Felix Rudolphi
>            Assignee: Maruan Sahyoun
>            Priority: Major
>         Attachments: Unfallmeldung_Bildungseinrichtungen_bf_01-2020.pdf
>
>
> When setting a value of a PDRadioButton programmatically by calling 
> setValue(value), it works well if value is just ASCII characters, but for 
> example "Universität" is encoded internally as "Universit#e4t", neither 
> approach works (the 2nd throws an exception). 
> The fix should write the correct encoded value, so that the respective 
> options is displayed as checked in PDF viewers.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to