Ah ok, that has answered on eof my questions. CFDOCUMENT doesn't support the 
vertical text that i use in my CSS so i'll have to convert the whole piece of 
code to iText Grrrrr!! Funnily enough I read somewhere that CFDOCUMENT is built 
using iText so you would think it would support some of its functions??

OK, I have found some code on the iText site .... can someone give me a hand in 
converting it to CF?

/* FROM: 
http://itext.ugent.be/library/com/lowagie/examples/fonts/styles/Vertical.java
 * $Id: Vertical.java 1742 2005-05-09 11:52:51Z blowagie $
 * $Name$
 *
 * This code is part of the 'iText Tutorial'.
 * You can find the complete tutorial at the following address:
 * http://itextdocs.lowagie.com/tutorial/
 *
 * This code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * [EMAIL PROTECTED]
 */
package com.lowagie.examples.fonts.styles;

import java.awt.Color;
import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.VerticalText;

/**
 * Writing Vertical Text.
 */
public class Vertical {
    
    static String texts[] = {
        "Some very long text to check if it wraps (or not).",
        " In blue.",
        "And now in orange another very long text.",
        "", "", ""};
        
    static String encs[] = {"UniJIS-UCS2-V", "Identity-V"};
    
    /**
     * @param text
     * @return converted text
     */
    public static String convertCid(String text) {
        char cid[] = text.toCharArray();
        for (int k = 0; k < cid.length; ++k) {
            char c = cid[k];
            if (c == '\n')
                cid[k] = '\uff00';
            else
                cid[k] = (char)(c - ' ' + 8720);
        }
        return new String(cid);
    }
    
    /**
     * Writing vertical text.
     * @param args no arguments needed
     */
    public static void main(String[] args) {
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);
        try {
            texts[3] = convertCid(texts[0]);
            texts[4] = convertCid(texts[1]);
            texts[5] = convertCid(texts[2]);
            PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream("vertical.pdf"));
            int idx = 0;
            document.open();
            PdfContentByte cb = writer.getDirectContent();
            for (int j = 0; j < 2; ++j) {
                BaseFont bf = BaseFont.createFont("KozMinPro-Regular", encs[j], 
false);
                cb.setRGBColorStroke(255, 0, 0);
                cb.setLineWidth(0);
                float x = 400;
                float y = 700;
                float height = 400;
                float leading = 30;
                int maxLines = 6;
                for (int k = 0; k < maxLines; ++k) {
                    cb.moveTo(x - k * leading, y);
                    cb.lineTo(x - k * leading, y - height);
                }
                cb.rectangle(x, y, -leading * (maxLines - 1), -height);
                cb.stroke();
                int status;
                VerticalText vt = new VerticalText(cb);
                vt.setVerticalLayout(x, y, height, maxLines, leading);
                vt.addText(new Chunk(texts[idx++], new Font(bf, 20)));
                vt.addText(new Chunk(texts[idx++], new Font(bf, 20, 0, 
Color.blue)));
                status = vt.go();
                System.out.println(status);
                vt.setAlignment(Element.ALIGN_RIGHT);
                vt.addText(new Chunk(texts[idx++], new Font(bf, 20, 0, 
Color.orange)));
                status = vt.go();
                System.out.println(status);
                document.newPage();
            }
            document.close();
        }
        catch (Exception de) {
            de.printStackTrace();
        }
    }


}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 beta – Build next generation applications today.
Free beta download on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281754
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to