Open the PDF in Acrobat and delete all the text, just leave the checkboxes. I'm 
sure no identification will remain.

Paulo

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, November 18, 2010 11:24 AM
To: Post all your questions about iText here
Subject: [iText-questions] Antwort: Re: Antwort: Re: Antwort: Re: how to find 
if a checkbox is checked (NOT get thevalue)

well then im not allowed to release the document as it may still contain
data sufficient to identify
one of our ensurants.
someone else has any suggestion how to get the status of there fields?



Mit freundlichen Grüßen
Christoph Mikusch

Berufsgenossenschaft Nahrungsmittel und Gaststätten
Dynamostraße 7 - 11
68165 Mannheim

 Telefon:  +49 (0) 621 4456-3127

 Mail:     [email protected]

 Internet: www.bgn.de







|------------>
| Von:       |
|------------>
  
>------------------------------------------------------------------------------------------------------------------------------------------|
  |Paulo Soares <[email protected]>                                            
                                                             |
  
>------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| An:        |
|------------>
  
>------------------------------------------------------------------------------------------------------------------------------------------|
  |Post all your questions about iText here 
<[email protected]>                                         
                 |
  
>------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Datum:     |
|------------>
  
>------------------------------------------------------------------------------------------------------------------------------------------|
  |18.11.2010 12:07                                                             
                                                             |
  
>------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Betreff:   |
|------------>
  
>------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [iText-questions] Antwort: Re: Antwort: Re: how to find if a checkbox is 
checked (NOT get        thevalue)                                 |
  
>------------------------------------------------------------------------------------------------------------------------------------------|





I asked for the PDF for the list, not for me.

Paulo

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, November 18, 2010 10:45 AM
To: Post all your questions about iText here
Subject: [iText-questions] Antwort: Re: Antwort: Re: how to find if a
checkbox is checked (NOT get thevalue)

hi paolo,

though ive x'ed all personal data out of the pdf im still not allowed to
post it openly to the list.
can you provide me with your personal email adress?



Mit freundlichen Grüßen
Christoph Mikusch

Berufsgenossenschaft Nahrungsmittel und Gaststätten
Dynamostraße 7 - 11
68165 Mannheim

 Telefon:  +49 (0) 621 4456-3127

 Mail:     [email protected]

 Internet: www.bgn.de







|------------>
| Von:       |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|

  |Paulo Soares <[email protected]>
|

>------------------------------------------------------------------------------------------------------------------------------------------|

|------------>
| An:        |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|

  |Post all your questions about iText here
<[email protected]>
|

>------------------------------------------------------------------------------------------------------------------------------------------|

|------------>
| Datum:     |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|

  |18.11.2010 10:34
|

>------------------------------------------------------------------------------------------------------------------------------------------|

|------------>
| Betreff:   |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|

  |Re: [iText-questions] Antwort: Re: how to find if a checkbox is checked
(NOT get     thevalue)                                             |

>------------------------------------------------------------------------------------------------------------------------------------------|






We'll have to see one of those PDFs.

Paulo

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, November 18, 2010 8:05 AM
To: Post all your questions about iText here
Subject: [iText-questions] Antwort: Re: how to find if a checkbox is
checked (NOT get thevalue)

hi,

thank you for you answer but it didnt solve the problem.

analyzing a checkbox with getAppearanceStates(key) gets [0} -> "Ja" and [1]
-> "Off" or [0} -> "" and [1] -> "Off"
problem is that getField(key) on an unchecked box does NOT return the value
"Off" but "" so when the checked
return value is defined as "" there is no difference in a checked or
unchecked box.

output from code down below:

possible answer: 0:  len:0                    #### no correct checked value
defined
possible answer: 1: Off len:3
original: Sibe_extern-> '' len:0            #### retval is empty string,
length 0, still the box is checked
new:      Sibe_extern-> '1' len:1
---------------------------------
possible answer: 0: Ja len:2               #### value "Ja" will be returned
if the box is checked
possible answer: 1: Off len:3
original: MV_nein-> '' len:0                  #### empty string is returned
because the box is unchecked,
new:      MV_nein-> '1' len:1
---------------------------------

again, to be independend from the pdf creators choice of the return values
i'd rather like to ignore those values and
"ask the document" if a box is displayed checked or unchecked.

    public boolean ParsePDF() {
        fieldsHashMapStrings = new HashMap();
        AcroFields acroFields = pdfReader.getAcroFields();
        HashMap<String, Item> fieldsHashMap = acroFields.getFields();
        if (fieldsHashMap.isEmpty()) {
            return false;
        }
        for (Iterator i = fieldsHashMap.keySet().iterator(); i.hasNext();)
{
            String key = i.next().toString();
            String value = null;
            value = acroFields.getField(key);
            if (acroFields.getFieldType(key) ==
AcroFields.FIELD_TYPE_CHECKBOX) {
                String[] appearanceStates = acroFields.getAppearanceStates
(key);
                for (int j = 0; j < appearanceStates.length; j++) {
                    String string = appearanceStates[j];
                    System.out.println("possible answer: "+j+": "+string+"
len:"+string.length());
                }
                System.out.println("original: "+key + "-> '" + value + "'
len:"+value.length());
                value = ("Off".equals(value) ? "0" : "1");
                System.out.println("new:      "+key + "-> '" + value + "'
len:"+value.length());
                System.out.println("---------------------------------");
            }
            fieldsHashMapStrings.put(key, value);
        }
        return true;
    }


Mit freundlichen Grüßen
Christoph Mikusch

Berufsgenossenschaft Nahrungsmittel und Gaststätten
Dynamostraße 7 - 11
68165 Mannheim

 Telefon:  +49 (0) 621 4456-3127

 Mail:     [email protected]

 Internet: www.bgn.de







|------------>
| Von:       |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|


  |"Mark Storer" <[email protected]>
|

>------------------------------------------------------------------------------------------------------------------------------------------|


|------------>
| An:        |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|


  |"Post all your questions about iText here"
<[email protected]>
|

>------------------------------------------------------------------------------------------------------------------------------------------|


|------------>
| Datum:     |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|


  |16.11.2010 19:34
|

>------------------------------------------------------------------------------------------------------------------------------------------|


|------------>
| Betreff:   |
|------------>

>------------------------------------------------------------------------------------------------------------------------------------------|


  |Re: [iText-questions] how to find if a checkbox is checked (NOT get
 thevalue)                                                         |

>------------------------------------------------------------------------------------------------------------------------------------------|







> can i ignore the creators string assignments by
> simply checking if the checkbox is *checked* so i can assign
> my own values like "true" and "false"?

The "on" value may change at the whim of the PDF creator, but the "off"
value does not.  So work with that:

value = acroFields.getField(key)/*.toString()*/;// getField() returns a
String, toString() is redundant, redundant and redundant.

if (acroFields.getFieldType(key) == AcroFields.FIELD_TYPE_CHECKBOX) {
  // I'm reasonably confident that case sensitivity here is okay.
  value = ("Off".equals(value) ? "false" : "true");
}

fieldsHashMapStrings.put(key, value);

This code ignores a null "value" (which becomes "true", almost certainly
not what you want), but I think you get the idea.

--Mark Storer
  Senior Software Engineer
  Cardiff.com

import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;



> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Monday, November 15, 2010 5:53 AM
> To: [email protected]
> Subject: [iText-questions] how to find if a checkbox is
> checked (NOT get thevalue)
>
>
>
>  hi,
>
> i get pdf-forms from an external source and have to transform
> the forms to a xml format (fieldname -> value) which up to
> now was no problem.
> but the crators of the pdf-forms do an inconsistent job with
> assigning string values to pdf- checkboxes...
> often getAppearanceStates is [0] -> "Ja", [1] -> "Off" but
> sometimes its [0] -> "", [1] -> "Off" so every type of
> questionaire pdf would have to be checked for irregulatitys
> on all checkbox states before converting into xml.... :/
> question is: can i ignore the creators string assignments by
> simply checking if the checkbox is *checked* so i can assign
> my own values like "true" and "false"?
>
> # little code to see if a field is a checkbox and # the
> creators assigned values for checked and undchecked
>
>     public boolean ParsePDF() {
>         fieldsHashMapStrings = new HashMap();
>         AcroFields acroFields = pdfReader.getAcroFields();
>         HashMap<String, Item> fieldsHashMap = acroFields.getFields();
>         for (Iterator i = fieldsHashMap.keySet().iterator();
> i.hasNext();) {
>             String key = i.next().toString();
>             String value = "";
>             if (acroFields.getField(key) != null) {
>                 if (acroFields.getFieldType(key) ==
> AcroFields.FIELD_TYPE_CHECKBOX) {
>                     System.out.println(key + " is checkbox");
>                     String[] appearanceStates =
> acroFields.getAppearanceStates(key);
>                     for (int j = 0; j <
> appearanceStates.length; j++) {
>                         String string = appearanceStates[j];
>                         System.out.println(j+"->"+string);
>                     }
>                 } else {
>                     value = acroFields.getField(key).toString();
>                 }
>             }
>             fieldsHashMapStrings.put(key, value);
>         }
>         return true;
>     }
>
> # sample output
>
> ...
> GefB_ang is checkbox
> 0->Ja
> 1->Off
> AnfProfil_Z_nein is checkbox
> 0->Ja
> 1->Off
> Sibe_intern is checkbox
> 0->                              ############ HERE the ARGH!
> 1->Off
> PSA_nein is checkbox
> 0->Ja
> 1->Off
> ....
>
>
> Mit freundlichen Grüßen
> Christoph Mikusch
>
> Berufsgenossenschaft Nahrungsmittel und Gaststätten
> Dynamostraße 7 - 11
> 68165 Mannheim
>
>  Telefon:  +49 (0) 621 4456-3127
>
>  Mail:     [email protected]
>
>  Internet: www.bgn.de
>
>
>
>
>
>
> --------------------------------------------------------------
> ----------------
> Centralized Desktop Delivery: Dell and VMware Reference
> Architecture Simplifying enterprise desktop deployment and
> management using Dell EqualLogic storage and VMware View: A
> highly scalable, end-to-end client virtualization framework.
> Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Many questions posted to this list can (and will) be answered
> with a reference to the iText book:
> http://www.itextpdf.com/book/ Please check the keywords list
> before you ask for examples: http://itextpdf.com/themes/keywords.php
>
>

------------------------------------------------------------------------------



Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php




------------------------------------------------------------------------------


Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão
desta mensagem não significa a perca de confidencialidade. Se esta mensagem
for recebida por engano, por favor envie-a de volta para o remetente e
apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o
destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may
contain confidential or legally protected information. The incorrect
transmission of this message does not mean the loss of its confidentiality.
If this message is received by mistake, please send it back to the sender
and delete it from your system immediately. It is forbidden to any person
who is not the intended receiver to use, distribute or copy any part of
this message.

------------------------------------------------------------------------------


Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php



------------------------------------------------------------------------------

Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão
desta mensagem não significa a perca de confidencialidade. Se esta mensagem
for recebida por engano, por favor envie-a de volta para o remetente e
apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o
destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may
contain confidential or legally protected information. The incorrect
transmission of this message does not mean the loss of its confidentiality.
If this message is received by mistake, please send it back to the sender
and delete it from your system immediately. It is forbidden to any person
who is not the intended receiver to use, distribute or copy any part of
this message.

------------------------------------------------------------------------------

Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to