Quantcast

Add form multiple times to a page

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Add form multiple times to a page

andilist


Hello,
i have a small AcroForm (credit card size) and want to put it multiple times on the same page (2 columns, 4 rows) with different content. The form is populated from a database.

E.g. if the database contains 13 rows i want to create a pdf with 2 pages (first page 8 records, second page 5 records)

I already found an example to create a new page for every dataset in the book iText in Action. Can anybody provide an example, on how to put the same form multiple times on one page?

Thanks
Andi

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Add form multiple times to a page

iText Info
Op 17/07/2012 22:07, Andreas Sachs schreef:
> i have a small AcroForm (credit card size) and want to put it multiple times on the same page (2 columns, 4 rows) with different content. The form is populated from a database.

If you have a PDF with a field (e.g. name) that needs to appear twice on
the same page (two widget annotations), then the content of those
widgets needs to be identical, because the field (name) can only have
one value (e.g. Andreas). A single field can never have two different
values (that would be a very ambiguous field).

However:

> I already found an example to create a new page for every dataset in the book iText in Action. Can anybody provide an example, on how to put the same form multiple times on one page?

You can of course introduce a hierarchy.
For instance, you can create parent fields person1, person2,... personN,
and create a child field with a single widget annotation for each of
these parent fields: person1.name, person2.name,... personN.name.

I think that's what you want to do: you want to create a template that
you can fill out with iText, adding the content of different records of
the same table to different fields on one page.

It's not clear if you want to create that template using iText
(possible, but some programming work) or a desktop tool such as Adobe
Acrobat (no programming involved).

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Add form multiple times to a page

andilist
Hello,
sorry to be unclear.

I have a small pdf form (size as a credit card). Several form fields (let's say name, forename). The form was created with acrobat.

I have a database with several records:
Name, Forename
A, A
B, B
C, C
...

With iText, i want create a single pdf (size DIN A4) which should contain the filled out forms for all database records. The form should be flatten.

I already found a solution to create a new page for every record, but since the form is very small, i want to put multiple filled out forms on one page.


I don't want:
Page 1:
Flatten form with data from record 1

Page 2:
Flatten form with data from record 2

Page 3:
Flatten form with data from record 3

Page 4:
Flatten form with data from record 4

...

I want this:
Page 1:
Flatten form with data from record 1
Flatten form with data from record 2
Flatten form with data from record 3

Page 2:
Flatten form with data from record 4
Flatten form with data from record 5
Flatten form with data from record 6


It would be even better if such a layout would be possible:

Page 1:
R1  R2
R3  R4
R5  R6

Page2:
R7  R8
R9  R10
R11  R12
...


I have no problems filling and flatten the form. But i don't know how i can add several filled out forms on one page.

I hope it's more clear now.




Thanks
Andreas


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Add form multiple times to a page

iText Info
Op 18/07/2012 12:28, Andreas Sachs schreef:

> It would be even better if such a layout would be possible:
>
> Page 1:
> R1  R2
> R3  R4
> R5  R6
>
> Page2:
> R7  R8
> R9  R10
> R11  R12
> ...
>
>
> I have no problems filling and flatten the form. But i don't know how i can add several filled out forms on one page.
>
> I hope it's more clear now.

Of course that's possible. That's explained in the book, isn't it?
You can create the separate cards in memory.
Use the bytes of those cards to create a PdfReader.
Create a PdfImportedPage with the getImportedPage() method.
Now you have a choice:
- PdfImportedPage extends PdfTemplate, so you can add the card using
addTemplate,
- You can wrap a PdfImportedPage object in an Image object, and add the
Images (for instance in a PdfPTable).

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Add form multiple times to a page

andilist
Hi,

> Of course that's possible. That's explained in the book, isn't it?
> You can create the separate cards in memory.
> Use the bytes of those cards to create a PdfReader.
> Create a PdfImportedPage with the getImportedPage() method.
> Now you have a choice:
> - PdfImportedPage extends PdfTemplate, so you can add the card using
> addTemplate,
> - You can wrap a PdfImportedPage object in an Image object, and add the
> Images (for instance in a PdfPTable).

Thank you for this tipps. It's working.

Andreas

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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
Loading...