Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-07-2003, 02:06 AM   PM User | #1
Fluid
New to the CF scene

 
Join Date: Mar 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Fluid is an unknown quantity at this point
Classcastexception

hi guys, i am having problems wif a code i got from the net. I can compile the code fine but when i try to run it, i will get a "java.lang.ClassCastException: HelloWorld".
Below is my code. Please help me solve the problem thanx.

--------------------------------------------------------------------------------
import java.util.*;
import java.io.*;
import java.awt.Color;
import org.faceless.pdf.*;

// Yes, it's the Hello World example.
//
public class HelloWorld
{
public static void main(String[] args)
{
// Create a new PDF
PDF p = new PDF();

// Create a new page
//
PDFPage page = p.newPage(PDF.PAGESIZE_A4);
page.setFilter(PDFPage.FILTER_NONE);

// Create a new "style" to write in - Black 24pt Helvetica.
//
PDFStyle mystyle = new PDFStyle();
mystyle.setFont(new StandardFont(StandardFont.HELVETICA), 24);
mystyle.setFillColor(Color.black);

// Put something on the page.
//
page.setStyle(mystyle);
page.drawText("Hello, PDF-viewing World!", 100, page.getHeight()-100);


// Automatically go to this page when the document is opened,
// zoom to fit.
//
p.setOpenAction(PDFAction.goToFit(page));

// Add some document info
//
p.setInfo("Author", "Joe Bloggs");
p.setInfo("Title", "My First Document");

// Put a password on the document, which the user will need to enter
// before the document can be viewed.
//
p.setPassword("password");

// Write the document to a file
//
try {
OutputStream fo = new FileOutputStream("HelloWorld.pdf");
p.render(fo);
fo.close();
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}

---------------------------------------------------------------------------------
Fluid is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:15 AM.


Advertisement
Log in to turn off these ads.