Hi!
Starting research on a new project. We need to take templates
(preferrably created in InDesign or other Adobe tool) and auto-populate
text fields on the fly from the server. This is all Microsoft, III,
and basic ASP, and of course, SQL Server.
We would need to generate pages and fill templates with text and would
also need to dynamically change images in their placeholders.
Can anyone give me some advice on how best to go about this?
Thanks in advance!
|
|
0
|
|
|
|
Reply
|
teillon (1)
|
12/19/2006 1:34:05 AM |
|
teillon wrote:
> Hi!
>
> Starting research on a new project. We need to take templates
> (preferrably created in InDesign or other Adobe tool) and auto-populate
> text fields on the fly from the server. This is all Microsoft, III,
> and basic ASP, and of course, SQL Server.
>
> We would need to generate pages and fill templates with text and would
> also need to dynamically change images in their placeholders.
>
> Can anyone give me some advice on how best to go about this?
The best way to do this on-the-fly is by using iText.
Last week I gave a demo at JavaPolis explaining how to do it.
As soon as the presentation is online I'll let you know.
Meanwhile, look for the book 'iText in Action'.
Note that the method replaceButton in iText does exactly
what you need: it allows you to replace the icon of an
existing button.
iText is a free / open source software library written
in Java, but there's also a C# port called iTextSharp.
br,
Bruno
|
|
0
|
|
|
|
Reply
|
Bruno
|
12/19/2006 1:53:40 PM
|
|
Bruno,
iText implies to me that you are just creating new pdf's out of text.
What I need is to start with a graphic design package template (think
full color graphic, magazine ready layouts) and then be able to insert
both formatted text and images into specified "placeholders" in the
template...
We would like to use Adobe products to create the templates...
thanks!
Bruno Lowagie wrote:
> teillon wrote:
> > Hi!
> >
> > Starting research on a new project. We need to take templates
> > (preferrably created in InDesign or other Adobe tool) and auto-populate
> > text fields on the fly from the server. This is all Microsoft, III,
> > and basic ASP, and of course, SQL Server.
> >
> > We would need to generate pages and fill templates with text and would
> > also need to dynamically change images in their placeholders.
> >
> > Can anyone give me some advice on how best to go about this?
>
> The best way to do this on-the-fly is by using iText.
> Last week I gave a demo at JavaPolis explaining how to do it.
> As soon as the presentation is online I'll let you know.
> Meanwhile, look for the book 'iText in Action'.
> Note that the method replaceButton in iText does exactly
> what you need: it allows you to replace the icon of an
> existing button.
> iText is a free / open source software library written
> in Java, but there's also a C# port called iTextSharp.
> br,
> Bruno
|
|
0
|
|
|
|
Reply
|
teillon
|
12/19/2006 3:09:18 PM
|
|
teillon wrote:
> Bruno,
>
> iText implies to me that you are just creating new pdf's out of text.
What gives you that idea? If you create an AcroForm using Acrobat
(or any other tool), iText can fill it.
These are some examples from my demo at JavaPolis:
OutputStream os = getMyOutputStream();
PdfReaderreader = new PdfReader("form.pdf");
PdfStamperstamper = new PdfStamper(reader, os);
AcroFieldsform = stamper.getAcroFields();form.setField("name", "Laura");
form.setField("location", "Foobar");
form.setField("job", "developer");
stamper.close();
The example above works with AcroForms AND XFA forms.
The form may be as complex as you want, with fields
on different pages.
The examples below only work with AcroForms (not with XFA):
This changes the text color of the field with name 'type'
and the background color of the 'filmfestival' field.
PdfReaderreader = new PdfReader("form.pdf");
PdfStamperstamper = new PdfStamper(reader, os);
AcroFieldsform = stamper.getAcroFields();
form.setFieldProperty("type", "textcolor", Color.BLUE, null);
form.setField("type", "VIP Pass");
form.setFieldProperty("filmfestival", "bgcolor", Color.BLUE, null);
form.regenerateField("filmfestival");
stamper.setFormFlattening(true);
stamper.close();
The following example replaces the image on a button:
PdfReaderreader = new PdfReader("form.pdf");
PdfStamperstamper = new PdfStamper(reader, os);
AcroFieldsform = stamper.getAcroFields();
PushbuttonField bt = form.getNewPushbuttonFromField("photo");
bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);
bt.setProportionalIcon(true);
bt.setImage(Image.getInstance("picture.jpg"));
form.replacePushbuttonField("photo", bt.getField());
stamper.close();
I highly recommend using AcroForms instead of XFA.
> What I need is to start with a graphic design package template (think
> full color graphic, magazine ready layouts) and then be able to insert
> both formatted text and images into specified "placeholders" in the
> template...
OK, we're using Acrobat for this kind of work.
Then we use iText to change properties, fill in
the fields, flatten fields if necessary,...
> We would like to use Adobe products to create the templates...
I don't say you shouldn't.
I only say that when it comes to filling AcroForms,
playing with field properties, and so on, programmatically
(on the fly), you will always get the same answer: use iText.
You may try other products if you want to, but...
well, you'll end up with iText anyway (or with a product
that uses iText under the hood).
br,
Bruno
|
|
0
|
|
|
|
Reply
|
Bruno
|
12/19/2006 3:42:51 PM
|
|
Bruno Lowagie wrote:
> You may try other products if you want to, but...
> well, you'll end up with iText anyway (or with a product
> that uses iText under the hood).
No doubt, unless you want to spend $$$ for the commercial products.
Note that besides button image replacement, you can use a text field as
a placeholder, and easily replace it with an image or barcode. See my
xmf example here:
http://www.esnips.com/web/PDFTools
It uses iText (compiled to .exe with gcc/gcj).
|
|
0
|
|
|
|
Reply
|
chicks
|
12/19/2006 4:52:44 PM
|
|
|
4 Replies
350 Views
(page loaded in 0.107 seconds)
|