> Hi I think i'll take Paulh's advice and use the iText software.
>
[quoted text clipped - 6 lines]
>
> Thanks for the help
I'm finally getting somewhere with this - i've written the following code -
which creates my pdf.
Whats the best way for me to get the text into the correct position?
Also, when I add the paragraphs it automatically drops the second line down
despite the use of the new page item.
Any ideas?
<cfscript>
// create a 'Document' object
rectangle = CreateObject("java", "com.lowagie.text.Rectangle");
pageSize = Rectangle.init(240, 155);
Font = CreateObject("java", "com.lowagie.text.Font");
FontFactory = CreateObject("java", "com.lowagie.text.FontFactory");
Chunk = CreateObject("java", "com.lowagie.text.Chunk");
Element = CreateObject("java", "com.lowagie.text.Element");
CMYK = CreateObject("java", "com.lowagie.text.pdf.CMYKColor");
document = CreateObject("java", "com.lowagie.text.Document").init(pageSize, 0,
0, 0, 0);
Image = CreateObject("java", "com.lowagie.text.Image");
font1 = FontFactory.getFont(FontFactory.HELVETICA);
// get an outputstream for the PDF Writer
fileIO = CreateObject("java", "java.io.FileOutputStream");
// call the constructor, pass the location where you want
// the pdf to be created
fileIO.init("#expandpath("test2.pdf")#");
// get a PDF Writer var
writer = CreateObject("java", "com.lowagie.text.pdf.PdfWriter");
// call the static 'getInstance' factory method
writer.getInstance(document, fileIO);
// open the document
document.open();
// create a new paragraph
paragraph = CreateObject("java", "com.lowagie.text.Paragraph");
phrase = CreateObject("java", "com.lowagie.text.Phrase");
phrase0 = paragraph.init(" ", Font.init(Font.HELVETICA, 5));
phrase = paragraph.init("Name : #url.name#", Font.init(Font.HELVETICA, 5));
phrase.setAlignment(Element.ALIGN_CENTER);
phrase2 = paragraph.init("JobTitle : #url.jobtitle#",
Font.init(Font.HELVETICA, 5));
phrase2.setAlignment(Element.ALIGN_CENTER);
phrase3 = paragraph.init("Clubname : #url.clubname#",
Font.init(Font.HELVETICA, 5));
phrase3.setAlignment(Element.ALIGN_CENTER);
phrase4 = paragraph.init("Address 1 : #url.address1#",
Font.init(Font.HELVETICA, 5));
phrase4.setAlignment(Element.ALIGN_CENTER);
phrase5 = paragraph.init("Address 2 :#url.address2#",
Font.init(Font.HELVETICA, 5));
phrase5.setAlignment(Element.ALIGN_CENTER);
phrase6 = paragraph.init("Address 3 : #url.postcode#",
Font.init(Font.HELVETICA, 5));
phrase6.setAlignment(Element.ALIGN_CENTER);
phrase7 = paragraph.init("T : #url.telephone#", Font.init(Font.HELVETICA, 5));
phrase7.setAlignment(Element.ALIGN_CENTER);
phrase8 = paragraph.init("F : #url.fax#", Font.init(Font.HELVETICA, 5));
phrase8.setAlignment(Element.ALIGN_CENTER);
phrase9 = paragraph.init("E : #url.email#", Font.init(Font.HELVETICA, 5));
phrase9.setAlignment(Element.ALIGN_CENTER);
//add the image
png = Image.getInstance("#expandpath("businesscardside1.png")#");
png.scalePercent(24, 23.845);
png.setDpi(300,300);
png.setAlignment(Image.UNDERLYING);
document.add(png);
document.add(phrase0);
document.add(phrase0);
document.add(phrase0);
document.add(phrase);
document.add(phrase2);
document.add(phrase3);
document.add(phrase4);
document.add(phrase5);
document.add(phrase6);
document.add(phrase7);
document.add(phrase8);
document.add(phrase9);
document.newPage();
png1 = Image.getInstance("#expandpath("businesscardside2.png")#");
png1.setDpi(300,300);
png1.setAlignment(Image.UNDERLYING);
png1.scalePercent(24, 23.845);
document.add(png1);
// close the document (PDF Writer is listening and will automatically
// create the PDF for us
document.close();
</cfscript>