You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Zhenyu Chen <zc...@lumo.de> on 2013/10/17 16:39:27 UTC

WG: I find 2 Bugs in interactive.form, And I have resolved this 2 Bug. Here are the Code. Version 1.8.2

Hello Developer of pdfBox.
I found 2 Bug in interactive.form.PDTextbox. Version 1.8.2


1.        I want make new Textbox in pdf. It always failed because the type flag  "COSName.FT,="Tx"" never be set in the constructor.
The PDTextbox can only be correct initialized from COSDictionary.( That is only initialized from exist pdf file) .
I fixed this by add "getDictionary().setName(COSName.FT, "Tx");" in the constructor of PDTextbox.
Maybe it's not right place, but works in my project.

public PDTextbox( PDAcroForm theAcroForm )
    {
        super( theAcroForm );
        getDictionary().setName(COSName.FT, "Tx");
}
public PDTextbox( PDAcroForm theAcroForm, COSDictionary field)
  {
        super( theAcroForm, field);
        getDictionary().setName(COSName.FT, "Tx");
  }

2.       Same Bug in PDAnnotationWidget. Only the default constructor initialize the type flag  "COSName.SUBTYPE,= "Widget"".
But the default constructor were never be used. So I must use the PDAnnotationWidget to initialize the new PDTextbox, like blow.



PDAnnotationWidget Widget = new PDAnnotationWidget();

PDTextbox textBox = new PDTextbox(acroForm,Widget.getDictionary());



Otherwise I got an empty  PDAnnotationWidget from PDTextbox .getWidget().

Something not correct in PDField .getWidget().
If the the PDField create from user(not read from exist pdf file), the getWidget cannot get an correct initialized PDAnnotationWidget. The COSName.SUBTYPE will never be set.


Maybe the similar Bug in the whole org.apache.pdfbox.pdmodel.interactive.form:
the COSDictionary  of element are not initialized when user create it manually (Typical to insert new acroform  element).


I hope  that I can give  something help  to this opensource Project.
Could you check this and fix in next Version?



Chen,zhenyu

Re: WG: I find 2 Bugs in interactive.form, And I have resolved this 2 Bug. Here are the Code. Version 1.8.2

Posted by Timo Boehme <ti...@ontochem.com>.
Hello zhenyu Chen,

thanks for your bug description and solution. Could you please open a 
bug report in our tracking system under

https://issues.apache.org/jira/browse/PDFBOX


Thanks,
Timo


Am 17.10.2013 16:39, schrieb Zhenyu Chen:
>
> Hello Developer of pdfBox.
> I found 2 Bug in interactive.form.PDTextbox. Version 1.8.2
>
>
> 1.        I want make new Textbox in pdf. It always failed because the type flag  "COSName.FT,="Tx"" never be set in the constructor.
> The PDTextbox can only be correct initialized from COSDictionary.( That is only initialized from exist pdf file) .
> I fixed this by add "getDictionary().setName(COSName.FT, "Tx");" in the constructor of PDTextbox.
> Maybe it's not right place, but works in my project.
>
> public PDTextbox( PDAcroForm theAcroForm )
>      {
>          super( theAcroForm );
>          getDictionary().setName(COSName.FT, "Tx");
> }
> public PDTextbox( PDAcroForm theAcroForm, COSDictionary field)
>    {
>          super( theAcroForm, field);
>          getDictionary().setName(COSName.FT, "Tx");
>    }
>
> 2.       Same Bug in PDAnnotationWidget. Only the default constructor initialize the type flag  "COSName.SUBTYPE,= "Widget"".
> But the default constructor were never be used. So I must use the PDAnnotationWidget to initialize the new PDTextbox, like blow.
>
>
>
> PDAnnotationWidget Widget = new PDAnnotationWidget();
>
> PDTextbox textBox = new PDTextbox(acroForm,Widget.getDictionary());
>
>
>
> Otherwise I got an empty  PDAnnotationWidget from PDTextbox .getWidget().
>
> Something not correct in PDField .getWidget().
> If the the PDField create from user(not read from exist pdf file), the getWidget cannot get an correct initialized PDAnnotationWidget. The COSName.SUBTYPE will never be set.
>
>
> Maybe the similar Bug in the whole org.apache.pdfbox.pdmodel.interactive.form:
> the COSDictionary  of element are not initialized when user create it manually (Typical to insert new acroform  element).
>
>
> I hope  that I can give  something help  to this opensource Project.
> Could you check this and fix in next Version?
>
>
>
> Chen,zhenyu
>


-- 

  Timo Boehme
  OntoChem GmbH
  H.-Damerow-Str. 4
  06120 Halle/Saale
  T: +49 345 4780474
  F: +49 345 4780471
  timo.boehme@ontochem.com

_____________________________________________________________________

  OntoChem GmbH
  Geschäftsführer: Dr. Lutz Weber
  Sitz: Halle / Saale
  Registergericht: Stendal
  Registernummer: HRB 215461
_____________________________________________________________________