I suspect the fonts are not found. Try this:
 
BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false);
 
Best Regards,
Paulo Soares


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joakim H�glund \(Paynova\)
Sent: Thursday, July 29, 2004 2:42 PM
To: [EMAIL PROTECTED]
Subject: [iText-questions] PdfWriter Error

This code works like a charm to create a html-file, but as soon as I try to use it to create a pdf file I get the previous mentioned error.

Document document = new Document(PageSize.A4, 50, 25, 25, 10);

try

{

           HtmlWriter.getInstance(document, new FileOutputStream("E:\\Websajter\\www.paynova.com\\MerchantManagerCsharp\\pdfOutput\\HelloWorld.html"));

           document.open();

           document.add(new Paragraph("Hello World"));

           document.close();

}

catch(Exception e)

{

           throw e;

}

 

If I change HtmlWriter to PdfWriter and change the ending of the filename to .pdf I get this Error:

 

Exception of type com.lowagie.text.ExceptionConverter was thrown.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: com.lowagie.text.ExceptionConverter: Exception of type com.lowagie.text.ExceptionConverter was thrown.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

 

[ExceptionConverter: Exception of type com.lowagie.text.ExceptionConverter was thrown.]

   MerchantManagerCsharp.addProspect.createPDF() in c:\documents and settings\joahog\vswebcache\obelix.paynova.com\merchantmanagercsharp\addprospect.aspx.cs:501

   MerchantManagerCsharp.addProspect.Button1_Click(Object sender, EventArgs e) in c:\documents and settings\joahog\vswebcache\obelix.paynova.com\merchantmanagercsharp\addprospect.aspx.cs:593

   System.Web.UI.WebControls.Button.OnClick(EventArgs e)

   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

   System.Web.UI.Page.ProcessRequestMain() +1277

 

 

Thanks again,

Joakim H�glund

 

___________________________________________
PAYNOVA AB
Joakim H�glund
Development

Mobile : +46 (0)73 150 53 88
Office : +46 (0)8 517 100 00
Fax : +46 (0)8 517 100 10

Email: [EMAIL PROTECTED]

Paynova AB
Warfvinges v�g 24
P.O. Box 30107
SE-104 25 Stockholm

 

Reply via email to