You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Vorpahl,Lucinda" <vo...@heb.com> on 2015/01/06 21:31:33 UTC

How to draw duplicate data using PDFBox

I am creating a pdf document using pdfbox.
I have no problem creating the document with one rectangle filled in with data but now I want to copy the data and write it multiple times on the same page.
Example:

[Hello  How  Are   You][Hello  How  Are   You][Hello  How  Are   You]

I know I can write out the line of text over and over specifying the textTranslation but there is a lot of text so I wanted to see if there were other options like somehow cloning the original rectangle.
Does anyone have any suggestions?

Thank you,

Lucy Vorpahl
Software Developer
vorpahl.lucinda@heb.com<ma...@heb.com>


Re: How to draw duplicate data using PDFBox

Posted by John Hewson <jo...@jahewson.com>.
Yep, what you're after is a Form XObject. Unless you have a lot of repeated content there's not much advantage to using it.

-- John

> On 6 Jan 2015, at 13:35, Tilman Hausherr <TH...@t-online.de> wrote:
> 
> I was afraid that you would ask that, because I've never used it for creating, only had to do with it when rendering :-(
> 
> You could get the SuperimposePage.java example in the source download (which uses Layerutility), or this posting by "mkl":
> https://stackoverflow.com/questions/26256546/how-to-insert-an-pdpage-within-another-pdpage-with-pdfbox
> 
> While none of the two will directly do what you need, they should tell you the general direction to go, i.e. that you'd understand what a content stream is, and how to fill it, and what an XForm is.
> 
> I suggest you start with something very small and non confidential and post the code if it doesn't work properly.
> 
> 
> Tilman
> 
> 
> 
>> Am 06.01.2015 um 22:02 schrieb Vorpahl,Lucinda:
>> I'm sorry, I'm very new to PDFBox and am not familiar with Xform.
>> Do you know of a good reference or examples that I can use to help familiarize myself with it?
>> 
>> Thank you,
>> 
>> Lucy Vorpahl
>> Software Developer
>> vorpahl.lucinda@heb.com
>> 
>> -----Original Message-----
>> From: Tilman Hausherr [mailto:THausherr@t-online.de]
>> Sent: Tuesday, January 06, 2015 2:52 PM
>> To: users@pdfbox.apache.org
>> Subject: Re: How to draw duplicate data using PDFBox
>> 
>> You could create an XForm and invoke that one again and again.
>> 
>> Tilman
>> 
>>> Am 06.01.2015 um 21:31 schrieb Vorpahl,Lucinda:
>>> I am creating a pdf document using pdfbox.
>>> 
>>> I have no problem creating the document with one rectangle filled in
>>> with data but now I want to copy the data and write it multiple times
>>> on the same page.
>>> 
>>> Example:
>>> 
>>> Hello How Are You Hello How Are You Hello How Are You
>>> 
>>> I know I can write out the line of text over and over specifying the
>>> textTranslation but there is a lot of text so I wanted to see if there
>>> were other options like somehow cloning the original rectangle.
>>> 
>>> Does anyone have any suggestions?
>>> 
>>> Thank you,
>>> 
>>> Lucy Vorpahl
>>> 
>>> Software Developer
>>> 
>>> vorpahl.lucinda@heb.com <ma...@heb.com>
>>> 
> 

RE: How to draw duplicate data using PDFBox

Posted by "Vorpahl,Lucinda" <vo...@heb.com>.
I got it to work with the provided examples.
Thank you very much for your help.

Lucy Vorpahl
-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Tuesday, January 06, 2015 3:35 PM
To: users@pdfbox.apache.org
Subject: Re: How to draw duplicate data using PDFBox

I was afraid that you would ask that, because I've never used it for creating, only had to do with it when rendering :-(

You could get the SuperimposePage.java example in the source download (which uses Layerutility), or this posting by "mkl":
https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_questions_26256546_how-2Dto-2Dinsert-2Dan-2Dpdpage-2Dwithin-2Danother-2Dpdpage-2Dwith-2Dpdfbox&d=AwIC-g&c=RI9dKKMRNVHr9NFa7OQiQw&r=46g1Q9l2ygNJoVl15Feuc2oj-eK5kwz0sL2OtXB9UQA&m=K7M80HRQwt_5i-kStkwiYcqmy_8o4MNUeVIoMQDOf_8&s=iXuDVzPxIti5QIG0pn2XSebFdyPwj_0ZSx02_fgxq4c&e= 

While none of the two will directly do what you need, they should tell you the general direction to go, i.e. that you'd understand what a content stream is, and how to fill it, and what an XForm is.

I suggest you start with something very small and non confidential and post the code if it doesn't work properly.


Tilman



Am 06.01.2015 um 22:02 schrieb Vorpahl,Lucinda:
> I'm sorry, I'm very new to PDFBox and am not familiar with Xform.
> Do you know of a good reference or examples that I can use to help familiarize myself with it?
>
> Thank you,
>
> Lucy Vorpahl
> Software Developer
> vorpahl.lucinda@heb.com
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Tuesday, January 06, 2015 2:52 PM
> To: users@pdfbox.apache.org
> Subject: Re: How to draw duplicate data using PDFBox
>
> You could create an XForm and invoke that one again and again.
>
> Tilman
>
> Am 06.01.2015 um 21:31 schrieb Vorpahl,Lucinda:
>> I am creating a pdf document using pdfbox.
>>
>> I have no problem creating the document with one rectangle filled in
>> with data but now I want to copy the data and write it multiple times
>> on the same page.
>>
>> Example:
>>
>> Hello How Are You Hello How Are You Hello How Are You
>>
>> I know I can write out the line of text over and over specifying the
>> textTranslation but there is a lot of text so I wanted to see if there
>> were other options like somehow cloning the original rectangle.
>>
>> Does anyone have any suggestions?
>>
>> Thank you,
>>
>> Lucy Vorpahl
>>
>> Software Developer
>>
>> vorpahl.lucinda@heb.com <ma...@heb.com>
>>


Re: How to draw duplicate data using PDFBox

Posted by Tilman Hausherr <TH...@t-online.de>.
I was afraid that you would ask that, because I've never used it for 
creating, only had to do with it when rendering :-(

You could get the SuperimposePage.java example in the source download 
(which uses Layerutility), or this posting by "mkl":
https://stackoverflow.com/questions/26256546/how-to-insert-an-pdpage-within-another-pdpage-with-pdfbox

While none of the two will directly do what you need, they should tell 
you the general direction to go, i.e. that you'd understand what a 
content stream is, and how to fill it, and what an XForm is.

I suggest you start with something very small and non confidential and 
post the code if it doesn't work properly.


Tilman



Am 06.01.2015 um 22:02 schrieb Vorpahl,Lucinda:
> I'm sorry, I'm very new to PDFBox and am not familiar with Xform.
> Do you know of a good reference or examples that I can use to help familiarize myself with it?
>
> Thank you,
>
> Lucy Vorpahl
> Software Developer
> vorpahl.lucinda@heb.com
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Tuesday, January 06, 2015 2:52 PM
> To: users@pdfbox.apache.org
> Subject: Re: How to draw duplicate data using PDFBox
>
> You could create an XForm and invoke that one again and again.
>
> Tilman
>
> Am 06.01.2015 um 21:31 schrieb Vorpahl,Lucinda:
>> I am creating a pdf document using pdfbox.
>>
>> I have no problem creating the document with one rectangle filled in
>> with data but now I want to copy the data and write it multiple times
>> on the same page.
>>
>> Example:
>>
>> Hello How Are You Hello How Are You Hello How Are You
>>
>> I know I can write out the line of text over and over specifying the
>> textTranslation but there is a lot of text so I wanted to see if there
>> were other options like somehow cloning the original rectangle.
>>
>> Does anyone have any suggestions?
>>
>> Thank you,
>>
>> Lucy Vorpahl
>>
>> Software Developer
>>
>> vorpahl.lucinda@heb.com <ma...@heb.com>
>>


RE: How to draw duplicate data using PDFBox

Posted by "Vorpahl,Lucinda" <vo...@heb.com>.
I'm sorry, I'm very new to PDFBox and am not familiar with Xform.
Do you know of a good reference or examples that I can use to help familiarize myself with it?

Thank you,

Lucy Vorpahl
Software Developer
vorpahl.lucinda@heb.com

-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Tuesday, January 06, 2015 2:52 PM
To: users@pdfbox.apache.org
Subject: Re: How to draw duplicate data using PDFBox

You could create an XForm and invoke that one again and again.

Tilman

Am 06.01.2015 um 21:31 schrieb Vorpahl,Lucinda:
>
> I am creating a pdf document using pdfbox.
>
> I have no problem creating the document with one rectangle filled in 
> with data but now I want to copy the data and write it multiple times 
> on the same page.
>
> Example:
>
> Hello How Are You Hello How Are You Hello How Are You
>
> I know I can write out the line of text over and over specifying the 
> textTranslation but there is a lot of text so I wanted to see if there 
> were other options like somehow cloning the original rectangle.
>
> Does anyone have any suggestions?
>
> Thank you,
>
> Lucy Vorpahl
>
> Software Developer
>
> vorpahl.lucinda@heb.com <ma...@heb.com>
>


Re: How to draw duplicate data using PDFBox

Posted by Tilman Hausherr <TH...@t-online.de>.
You could create an XForm and invoke that one again and again.

Tilman

Am 06.01.2015 um 21:31 schrieb Vorpahl,Lucinda:
>
> I am creating a pdf document using pdfbox.
>
> I have no problem creating the document with one rectangle filled in 
> with data but now I want to copy the data and write it multiple times 
> on the same page.
>
> Example:
>
> Hello How Are You Hello How Are You Hello How Are You
>
> I know I can write out the line of text over and over specifying the 
> textTranslation but there is a lot of text so I wanted to see if there 
> were other options like somehow cloning the original rectangle.
>
> Does anyone have any suggestions?
>
> Thank you,
>
> Lucy Vorpahl
>
> Software Developer
>
> vorpahl.lucinda@heb.com <ma...@heb.com>
>