Re: iText and VerticalText

2007-06-21 Thread ally mccluskey
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 Gr!! 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


iText and VerticalText

2007-06-20 Thread ally mccluskey
Vertical Text in PDF using CFDOCUMENT 



I am using font tag in a CSS file to layout a table header using vertical text.
In HTML, the vertical text looks fine. However, when I convert the table to a
pdf using cfdocument, the vertical text is displayed as horizintal text and
does not follow the css specified font family, color or size.

I'm trying to use the iTEXT class VerticalText to create the text, but i'm 
having trouble understanding how to call the method.

I have created the object using [b]myObj.vertText = 
createObject(java,com.lowagie.text.pdf.VerticalText);[/b]

Does anyone have ideas on how to use iText and call its functions?

Thanks.

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

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


Query of Queries

2007-05-03 Thread ally mccluskey
Hi everyone, I really need some help with the following problem:

We are upgrading our system from CF 5 to MX 7, and i have a query of queries 
problem. My attached code is giving me this error: 

The following information is meant for the website developer for debugging 
purposes. 

Error Occurred While Processing Request 
Query Of Queries runtime error. 
Query Of Queries runtime error. 
Unsupported SQL type java.sql.Types.CLOB. 

The field WBLT_TEXT is the CLOB field. I have tried putting SELECT 
CAST(WBLT_TEXT as VARCHAR) into the ListBullets query but I get exactly the 
same error.

We are using Datadirect 3.5 drivers with a Type 4 JDBC Connection to an Oracle 
10g RAC

Your help is greatly appreciated. 
Ally

CFQUERY name=ReadBltInfo datasource=#Application.DSN#
SELECT  BLT_ID, BLT_PGEID, BLT_BULLETS
FROMWEBBULLETS
WHERE   BLT_ID = cfqueryparam cfsqltype=CF_SQL_INTEGER 
value=#iCurrentElement_ID# null=#yesNoFormat(NOT 
Len(trim(iCurrentElement_ID)))#
/CFQUERY
CFQUERY name=ListBulletsAll datasource=#Application.DSN#
SELECT WBLT_ID, WBLT_TEXT, WBLTELEM_ID
FROM WEBBLTS
WHERE WBLTELEM_ID = cfqueryparam 
value=#iCurrentElement_ID# cfsqltype=CF_SQL_INTEGER null=#yesNoFormat(NOT 
Len(trim(iCurrentElement_ID)))#
/CFQUERY

CFLOOP list=#ReadBltInfo.BLT_BULLETS# index=ibltid
 CFQUERY name=ListBullets dbtype=query
SELECT WBLT_TEXT
FROM ListBulletsAll
WHERE WBLT_ID = cfqueryparam value=#ibltid# 
cfsqltype=CF_SQL_INTEGER null=#yesNoFormat(NOT Len(trim(ibltid)))#
/CFQUERY
CF_TEXTAREAFORMAT INPUT=#ListBullets.WBLT_TEXT# 
OUTPUT=textarea

~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

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


Problem with CFCHART

2007-04-23 Thread ally mccluskey
Hi there, i'm having trouble upgrading some CFGRAPH code to CFCHART

There seems to be some functionality removed which doesn't allow unique IDs to 
be passed to a URL. For example:

In CF5 we have a page which graphs the Top 20 most viewed pages on our site. 
Each bar of the graph then links to that unique page when you click on it (ie. 
http://www.oursite.co.uk/page.cfm?ID=1234)

IN MX, I cant figure out how to pass the unique ID (PGE_ID) of that query row 
to the URL attribute of CFCHART . Here is my Code:

CFQUERY name=qPageHitsReport datasource=#Application.DSN#
SELECT PGE_HITCOUNT, PGE_DESC, PGE_ID
FROM ( SELECT PGE_HITCOUNT, PGE_DESC, PGE_ID
FROM RGUDBA.WEBPAGE
ORDER BY PGE_HITCOUNT DESC )
WHERE ROWNUM  21
/CFQUERY

CFCHART chartwidth=600 chartheight=500 title=Top 20 Pages by Page Views 
format=png URL=/general/info/page.cfm?pge=#PGE_ID# 
CFCHARTSERIES type=horizontalbar query=qPageHitsReport 
itemcolumn=PGE_DESC valuecolumn=PGE_HITCOUNT
/CFCHARTSERIES
/CFCHART 

With this code I get an error message: 

Error Occurred While Processing Request 
Variable PGE_ID is undefined. 

Is this not possible anymore? Surely Adobe havn't removed a really useful piece 
of functionality? . Or have they?

Ally 

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

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


Re: Problem with CFCHART

2007-04-23 Thread ally mccluskey
I tried chnaging the URL attribute to 
URL=/general/info/page.cfm?pge=#qPageHitsReport.PGE_ID#

This works, but passes the same PGE_ID for each bar  I guess i'm going to 
have to parse the query results, but what would be the best way to do this?

The CFCHART tag has no knowledge of the query, only the CFCHARTSERIES tag 
does.

Ally

~|
Macromedia ColdFusion MX7
Upgrade to MX7  experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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


CFCONTENT HTTPS

2007-04-05 Thread ally mccluskey
Hi, i'm having a problem migrating some CF5 code to MX7.

We have a page (code below) which runs perfetly fine on CF5 and on MX7 
throws an error Internet Explorer cannot download disp_displaydoc.cfm 
from blah blah blah We have managed to narrow the problem down to the 
page being served over HTTPS as it works ok on normal HTTP.

We really need this to run over SSL and wondered if anyone had any 
ideas on how we can serve these docs/pdfs etc. as before.

Thanks for your help, Ally

cfsilent
cfscript

function udfFileMimeType(sFilename)
{
  var sMime = ;
  var sExt = lcase(right(sFilename,3));

  switch(sExt) 
  {
case csv: { sMime = text/comma-separated-values;break; 
}
case doc: { sMime = application/msword;break; }
case htm: { sMime = text/html;break; }
case mdb: { sMime = application/msaccess;break; }
case mov: { sMime = video/quicktime;break; }
case pdf: { sMime = application/pdf;break; }
case ppt: { sMime = application/powerpoint;break; }
case rtf: { sMime = application/rtf;break; }
case txt: { sMime = text/plain;break; }
case xls: { sMime = application/excel;break; }
case xml: { sMime = application/xml;break; }
case zip: { sMime = application/zip;break; }

default: { sMime = application/unknown;break; }
  }

  Return sMime;
}

/cfscript

cfparam name=URL.DIR default=docs

cfset thisFile = URLDecode(URL.file)
cfheader name=content-disposition value='inline; 
filename=#thisFile#'
CFCONTENT file=#application.PSsavepath#\#URL.dir#\#thisFile# 
TYPE=#udfFileMimeType(thisFile)#

/cfsilent



~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade  see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

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