views:

18

answers:

1

Hi.

I have a JPanel panel with a bill designed and populated inside it.

I passed it to a printer function - which used iText to save it to a pdf. The basic flow of code is like this.

void printToPdf(JPanel panel)   {
    ...
    Image toEmbed = generateImage(panel);
    doc.add(toEmbed)
    ...
}

Now, according to the new requirements, i need to make four copies of the bill (within the same pdf document). Each copy has a different value for a copyName JTextField (Seller, Buyer, etc).

Is there a way i can change the value of copyName within prinToPdf()?

+1  A: 

If you have a reference to the JTextField, just call setText() on it in each iteration, at the end just restore the first one.

Romain Hippeau
ha, that makes sense. Trying it now 8|
wretrOvian
worked. Thanks you :)
wretrOvian