You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Tilman Hausherr <TH...@t-online.de> on 2015/07/01 00:19:24 UTC

Re: Dries Horions boxable PDFBox Table class

Am 30.06.2015 um 16:05 schrieb Mark Bolduc:
> I am looking for help in running this TableTest as there are 3 Classes I
> can't locate and have searched
> https://github.com/dhorions/boxable/blob/master/src/test/java/be/quodlibet/b
> oxable/TableTest.java
>
> The missing Classes are:
> BaseTable
> Row
> Cell

They are all here:
https://github.com/dhorions/boxable/tree/master/src/main/java/be/quodlibet/boxable

You're probably somewhat confused, or maybe a beginner. You posted to 
the PDFBox user mailing list, but your question is about boxable, a 
project that uses PDFBox.

The best is to build that project
https://github.com/dhorions/boxable
by getting it with git (URL: https://github.com/dhorions/boxable.git) or 
svn (svn URL: https://github.com/dhorions/boxable) and then run maven. 
If you lucky, these are supported by your IDE.

Tilman

>
> ----------------------------------------------------------------------------
> -----------------
> https://github.com/dhorions/boxable/blob/multi-line-rows/README.md
> boxable:
> Create tables in pdf documents using PDFBox
> http://pdfbox.apache.org/
> .Example pdf can be found at http://goo.gl/a7QvRM
> .Example code can be found at
> https://github.com/dhorions/boxable/blob/master/src/be/quodlibet/boxable/exa
> mples/example1.java
>
> Any Help would be appreciated.
> Regards
> Mark Bolduc
>
>
> -----Original Message-----
> From: Maruan Sahyoun [mailto:sahyoun@fileaffairs.de]
> Sent: Tuesday, June 30, 2015 9:06 AM
> To: users@pdfbox.apache.org
> Subject: Re: Migrate form field entries from one pdf to another
>
> Hi,
>
>> Am 30.06.2015 um 10:21 schrieb Roberto Nibali <rn...@gmail.com>:
>>
>> Hello
>>
>> Thanks for the answers. I have attached two PDFs by hopefully removing all
> traces that could violate the NDA, which I can't get to work.
>>>> Normally when a checkbox is checked the fields value AND the
>>>> appearance need to be updated. This is not the case with your form.
>>>> How was the value of the original form set? Which software?
>>>>
>>> The value set in the form is by simply clicking it in Adobe Acrobat
>>> (Reader). It sets the field accordingly, nevertheless for a set
>>> field,
>>> getValue() still returns null. The forms themselves were created
>>> with InDesign, I think. Not sure though. So, you're kind of implying
>>> that independent of the field type (Textbox, PrintButton, Checkbox,
>>> Radiobutton), PDFBox would normally expect the value of a field to be
> !null?
>> I did a quick test with a newly created form using Adobe Acrobat and
> setting the checkbox also with Acrobat. There the value is not null when the
> checkbox has been checked.
>> I have attached now PDFs, where with my tool the value is null.
>
> unfortunately the attachments didn't make it through the mailing list. Could
> you upload them to a public location?
>
> BR
> Maruan
>
>>> How could I deal with this? Because this is exactly what seems to
>>> fail and also cause this dreaded exception message when trying to
>>> fill out the forms with anything other than PDTextbox.
>> Without looking at the form:
>>
>> a) test if getValue returns null if not take that value
>> b) if it returns null test if the box has been checked - if yes take that
> value.
>> Which value?
>>   
>> use the value retrieved from a) or b) to set the fields value in the pdf
> template.
>> I'm not sure which value you mean.
>>   
>> What would be helpful is either a screenshot of the form fields entries
> using the PDFDebugger
> [http://pdfbox.apache.org/1.8/commandline.html#pdfDebugger
> <http://pdfbox.apache.org/1.8/commandline.html#pdfDebugger>] or the printout
> of the fields getDictionary() method so there is some more information about
> how the field definition looks lie. Best would be to have the form of
> course.
>> Attached. Also you can find the code here: http://pastebin.com/Ra0ebSis
> <http://pastebin.com/Ra0ebSis>. Let me know if something else is needed.
>> The idea is that you call it with the template TestTemplate.pdf and the
> input PDF Test.pdf, resulting in an output PDF that is a carbon-copy of the
> input PDF, but with the template PDF CI/CD (in my test case they are
> identical, but it serves the purpose).
>>   
>>> Would anybody here be willing to have a Skype or Teamviewer session
>>> with me tonight or tomorrow night to have a look at the problem?
>>> We're willing to pay for such support. If so, please send a private
>>> message to me, so we don't clutter this mailing list.
>> I'm currently on travel so won't be able to do that
>>
>> Thanks, anybody else?
>>
>> Cheers
>> Roberto
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Dries Horions boxable PDFBox Table class

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.07.2015 um 14:34 schrieb Mark Bolduc:
> Thanks.
>
> Can you point me to where I can find published projects where people have
> created more higher level functionality?

Yes, this ones:
https://github.com/dhorions/boxable (which is the one you mentioned)

https://stackoverflow.com/questions/28059563/how-to-create-table-using-apache-pdfbox
http://fahdshariff.blogspot.de/2010/10/creating-tables-with-pdfbox.html

Tilman

>
> Regards
> Mark Bolduc
>
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Wednesday, July 01, 2015 2:40 AM
> To: users@pdfbox.apache.org
> Subject: Re: Dries Horions boxable PDFBox Table class
>
> Am 01.07.2015 um 04:57 schrieb Mark Bolduc:
>> Thanks, I am brand new to PDFBox,
> Note that PDFBox is rather low-level compared to PDFBox. You need to do a
> lot yourself. It helps to look at the PDF specification.
>
>> Does anyone have a method to create a rectangle with rounded corners?
> in a PDPageContentStrean use
>
> /**
>        * Set the line join style.
>        * @param lineJoinStyle 0 for miter join, 1 for round join, and 2 for
> bevel join.
>        * @throws IOException If there is an error while writing to the
> stream.
>        */
>       public void setLineJoinStyle(int lineJoinStyle) throws IOException
>
> /**
>        * Add a rectangle to the current path.
>        *
>        * @param x The lower left x coordinate.
>        * @param y The lower left y coordinate.
>        * @param width The width of the rectangle.
>        * @param height The height of the rectangle.
>        * @throws IOException If there is an error while drawing on the
> screen.
>        */
>       public void addRect(float x, float y, float width, float height) throws
> IOException
>
>
>       /**
>        * Stroke the path.
>        *
>        * @throws IOException If there is an error while stroking the path.
>        */
>       public void stroke() throws IOException
>
>
> to understand about content streams, download the source code and look a the
> examples. Here's one that creates filled boxes:
>
>               PDDocument doc = new PDDocument();
>
>               PDPage page = new PDPage();
>               doc.addPage( page );
>
>               PDPageContentStream contentStream = new
> PDPageContentStream(doc, page);
>               //first fill the entire background with cyan
>               contentStream.setNonStrokingColor( Color.CYAN );
>               contentStream.fillRect( 0,0, page.findMediaBox().getWidth(),
> page.findMediaBox().getHeight() );
>
>               //then draw a red box in the lower left hand corner
>               contentStream.setNonStrokingColor( Color.RED );
>               contentStream.fillRect( 10, 10, 100, 100 );
>
>               contentStream.close();
>               doc.save( file );
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


RE: Dries Horions boxable PDFBox Table class

Posted by Mark Bolduc <ma...@comcast.net>.
Thanks. 

Can you point me to where I can find published projects where people have
created more higher level functionality?

Regards
Mark Bolduc


-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Wednesday, July 01, 2015 2:40 AM
To: users@pdfbox.apache.org
Subject: Re: Dries Horions boxable PDFBox Table class

Am 01.07.2015 um 04:57 schrieb Mark Bolduc:
> Thanks, I am brand new to PDFBox,

Note that PDFBox is rather low-level compared to PDFBox. You need to do a
lot yourself. It helps to look at the PDF specification.

>
> Does anyone have a method to create a rectangle with rounded corners?

in a PDPageContentStrean use

/**
      * Set the line join style.
      * @param lineJoinStyle 0 for miter join, 1 for round join, and 2 for
bevel join.
      * @throws IOException If there is an error while writing to the
stream.
      */
     public void setLineJoinStyle(int lineJoinStyle) throws IOException

/**
      * Add a rectangle to the current path.
      *
      * @param x The lower left x coordinate.
      * @param y The lower left y coordinate.
      * @param width The width of the rectangle.
      * @param height The height of the rectangle.
      * @throws IOException If there is an error while drawing on the
screen.
      */
     public void addRect(float x, float y, float width, float height) throws
IOException


     /**
      * Stroke the path.
      *
      * @throws IOException If there is an error while stroking the path.
      */
     public void stroke() throws IOException


to understand about content streams, download the source code and look a the
examples. Here's one that creates filled boxes:

             PDDocument doc = new PDDocument();

             PDPage page = new PDPage();
             doc.addPage( page );

             PDPageContentStream contentStream = new
PDPageContentStream(doc, page);
             //first fill the entire background with cyan
             contentStream.setNonStrokingColor( Color.CYAN );
             contentStream.fillRect( 0,0, page.findMediaBox().getWidth(),
page.findMediaBox().getHeight() );

             //then draw a red box in the lower left hand corner
             contentStream.setNonStrokingColor( Color.RED );
             contentStream.fillRect( 10, 10, 100, 100 );

             contentStream.close();
             doc.save( file );



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Dries Horions boxable PDFBox Table class

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.07.2015 um 04:57 schrieb Mark Bolduc:
> Thanks, I am brand new to PDFBox,

Note that PDFBox is rather low-level compared to PDFBox. You need to do 
a lot yourself. It helps to look at the PDF specification.

>
> Does anyone have a method to create a rectangle with rounded corners?

in a PDPageContentStrean use

/**
      * Set the line join style.
      * @param lineJoinStyle 0 for miter join, 1 for round join, and 2 
for bevel join.
      * @throws IOException If there is an error while writing to the 
stream.
      */
     public void setLineJoinStyle(int lineJoinStyle) throws IOException

/**
      * Add a rectangle to the current path.
      *
      * @param x The lower left x coordinate.
      * @param y The lower left y coordinate.
      * @param width The width of the rectangle.
      * @param height The height of the rectangle.
      * @throws IOException If there is an error while drawing on the 
screen.
      */
     public void addRect(float x, float y, float width, float height) 
throws IOException


     /**
      * Stroke the path.
      *
      * @throws IOException If there is an error while stroking the path.
      */
     public void stroke() throws IOException


to understand about content streams, download the source code and look a 
the examples. Here's one that creates filled boxes:

             PDDocument doc = new PDDocument();

             PDPage page = new PDPage();
             doc.addPage( page );

             PDPageContentStream contentStream = new 
PDPageContentStream(doc, page);
             //first fill the entire background with cyan
             contentStream.setNonStrokingColor( Color.CYAN );
             contentStream.fillRect( 0,0, 
page.findMediaBox().getWidth(), page.findMediaBox().getHeight() );

             //then draw a red box in the lower left hand corner
             contentStream.setNonStrokingColor( Color.RED );
             contentStream.fillRect( 10, 10, 100, 100 );

             contentStream.close();
             doc.save( file );



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


RE: Dries Horions boxable PDFBox Table class

Posted by Mark Bolduc <ma...@comcast.net>.
Thanks, I am brand new to PDFBox, 

Does anyone have a method to create a rectangle with rounded corners?

I'm a custom to ITEXT roundRectangle (x, y, x_length, heightFromBottom,
radius);  method.

Thanks in Advance.

Regards
Mark Bolduc


-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Tuesday, June 30, 2015 6:19 PM
To: users@pdfbox.apache.org
Subject: Re: Dries Horions boxable PDFBox Table class

Am 30.06.2015 um 16:05 schrieb Mark Bolduc:
> I am looking for help in running this TableTest as there are 3 Classes I
> can't locate and have searched
>
https://github.com/dhorions/boxable/blob/master/src/test/java/be/quodlibet/b
> oxable/TableTest.java
>
> The missing Classes are:
> BaseTable
> Row
> Cell

They are all here:
https://github.com/dhorions/boxable/tree/master/src/main/java/be/quodlibet/b
oxable

You're probably somewhat confused, or maybe a beginner. You posted to 
the PDFBox user mailing list, but your question is about boxable, a 
project that uses PDFBox.

The best is to build that project
https://github.com/dhorions/boxable
by getting it with git (URL: https://github.com/dhorions/boxable.git) or 
svn (svn URL: https://github.com/dhorions/boxable) and then run maven. 
If you lucky, these are supported by your IDE.

Tilman

>
>
----------------------------------------------------------------------------
> -----------------
> https://github.com/dhorions/boxable/blob/multi-line-rows/README.md
> boxable:
> Create tables in pdf documents using PDFBox
> http://pdfbox.apache.org/
> .Example pdf can be found at http://goo.gl/a7QvRM
> .Example code can be found at
>
https://github.com/dhorions/boxable/blob/master/src/be/quodlibet/boxable/exa
> mples/example1.java
>
> Any Help would be appreciated.
> Regards
> Mark Bolduc
>
>
> -----Original Message-----
> From: Maruan Sahyoun [mailto:sahyoun@fileaffairs.de]
> Sent: Tuesday, June 30, 2015 9:06 AM
> To: users@pdfbox.apache.org
> Subject: Re: Migrate form field entries from one pdf to another
>
> Hi,
>
>> Am 30.06.2015 um 10:21 schrieb Roberto Nibali <rn...@gmail.com>:
>>
>> Hello
>>
>> Thanks for the answers. I have attached two PDFs by hopefully removing
all
> traces that could violate the NDA, which I can't get to work.
>>>> Normally when a checkbox is checked the fields value AND the
>>>> appearance need to be updated. This is not the case with your form.
>>>> How was the value of the original form set? Which software?
>>>>
>>> The value set in the form is by simply clicking it in Adobe Acrobat
>>> (Reader). It sets the field accordingly, nevertheless for a set
>>> field,
>>> getValue() still returns null. The forms themselves were created
>>> with InDesign, I think. Not sure though. So, you're kind of implying
>>> that independent of the field type (Textbox, PrintButton, Checkbox,
>>> Radiobutton), PDFBox would normally expect the value of a field to be
> !null?
>> I did a quick test with a newly created form using Adobe Acrobat and
> setting the checkbox also with Acrobat. There the value is not null when
the
> checkbox has been checked.
>> I have attached now PDFs, where with my tool the value is null.
>
> unfortunately the attachments didn't make it through the mailing list.
Could
> you upload them to a public location?
>
> BR
> Maruan
>
>>> How could I deal with this? Because this is exactly what seems to
>>> fail and also cause this dreaded exception message when trying to
>>> fill out the forms with anything other than PDTextbox.
>> Without looking at the form:
>>
>> a) test if getValue returns null if not take that value
>> b) if it returns null test if the box has been checked - if yes take that
> value.
>> Which value?
>>   
>> use the value retrieved from a) or b) to set the fields value in the pdf
> template.
>> I'm not sure which value you mean.
>>   
>> What would be helpful is either a screenshot of the form fields entries
> using the PDFDebugger
> [http://pdfbox.apache.org/1.8/commandline.html#pdfDebugger
> <http://pdfbox.apache.org/1.8/commandline.html#pdfDebugger>] or the
printout
> of the fields getDictionary() method so there is some more information
about
> how the field definition looks lie. Best would be to have the form of
> course.
>> Attached. Also you can find the code here: http://pastebin.com/Ra0ebSis
> <http://pastebin.com/Ra0ebSis>. Let me know if something else is needed.
>> The idea is that you call it with the template TestTemplate.pdf and the
> input PDF Test.pdf, resulting in an output PDF that is a carbon-copy of
the
> input PDF, but with the template PDF CI/CD (in my test case they are
> identical, but it serves the purpose).
>>   
>>> Would anybody here be willing to have a Skype or Teamviewer session
>>> with me tonight or tomorrow night to have a look at the problem?
>>> We're willing to pay for such support. If so, please send a private
>>> message to me, so we don't clutter this mailing list.
>> I'm currently on travel so won't be able to do that
>>
>> Thanks, anybody else?
>>
>> Cheers
>> Roberto
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org