Foros del Web » Programación para mayores de 30 ;) » .NET »

ayuda con c#

Estas en el tema de ayuda con c# en el foro de .NET en Foros del Web. hola amigos quiero ver si alguien me puede ayudar, lo que pasa es que necesito pasar html en c# a pdf, puedo pasar de texto ...
  #1 (permalink)  
Antiguo 31/08/2007, 11:17
 
Fecha de Ingreso: agosto-2007
Mensajes: 4
Antigüedad: 17 años, 6 meses
Puntos: 0
ayuda con c#

hola amigos quiero ver si alguien me puede ayudar, lo que pasa es que necesito pasar html en c# a pdf, puedo pasar de texto a pdf sin problemas pero de html aun no puedo,trato y trato y no puedo alguien me ayuda plz?????
  #2 (permalink)  
Antiguo 01/09/2007, 10:03
Avatar de RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 23 años, 1 mes
Puntos: 50
Re: ayuda con c#

Que componente estás usando para pasar a PDF porque puedes ocupar el iTextSharp totalmente open source y que se adapta a lo que necesitas

Salu2
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net
  #3 (permalink)  
Antiguo 03/09/2007, 14:47
 
Fecha de Ingreso: agosto-2007
Mensajes: 4
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: ayuda con c#

muchas gracias por la respuesta, si uso el itextsharp y puedo pasar cualquier txt por decirlo asi a pdf, pero de html a pdf y me tira errores weones que no deberian salir, con este codigo deberia pasarse segun yo ke son los ejemplos, pero me tira errores con con el catch, ojala me puedan ayudar es de suma importancia :(


using System;
using System.IO;
using System.util;

using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.xml;
using System.Collections;
using iTextSharp.text.html;

namespace iTextSharp.tutorial.Chap07
{
/// <summary>
/// Chap0706 ժҪ˵
/// </summary>
public class Chap0707
{
public Chap0707()
{
Console.WriteLine("Chapter 7 example 7: parsing the HTML from example 2");

// step 1: creation of a document-object
Document document = new Document(PageSize.A4, 80, 50, 30, 65);

try
{

// step 2:
// we create a writer that listens to the document
// and directs a XML-stream to a file
PdfWriter.GetInstance(document, new FileStream("Chap0707.pdf", FileMode.Create));

// // step 3: we create a parser and set the document handler
// Parser parser = ParserFactory.makeParser(PARSER);
// parser.setDocumentHandler(new SAXmyHtmlHandler(document));
// step 3: we create a parser

// ITextHandler h = new ITextHandler(document);
HtmlParser.Parse(document,"Chap0702.htm");

// step 4: we parse the document _Document;
// h.Parse("Chap0702.htm");
// step 4: we parse the document
// parser.parse("Chap0702.html");

}
catch(Exception e)
{
Console.Error.WriteLine(e.Message);
Console.Error.WriteLine(e.StackTrace);
}
}
}
}
  #4 (permalink)  
Antiguo 03/09/2007, 17:32
Avatar de RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 23 años, 1 mes
Puntos: 50
Re: ayuda con c#

Cita:
me tira errores weones que no deberian salir
y cuales son esos errores?
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net
  #5 (permalink)  
Antiguo 04/09/2007, 07:47
 
Fecha de Ingreso: agosto-2007
Mensajes: 4
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: ayuda con c#

Cita:
Iniciado por RootK Ver Mensaje
y cuales son esos errores?
private void button3_Click(object sender, EventArgs e)
{
Console.WriteLine("Chapter 7 example 7: parsing the HTML from example 2");

// step 1: creation of a document-object
Document document = new Document(PageSize.A4, 80, 50, 30, 65);

try
{

// step 2:
// we create a writer that listens to the document
// and directs a XML-stream to a file
PdfWriter.GetInstance(document, new FileStream("Chap0707.pdf", FileMode.Create));

// // step 3: we create a parser and set the document handler
// Parser parser = ParserFactory.makeParser(PARSER);
// parser.setDocumentHandler(new SAXmyHtmlHandler(document));
// step 3: we create a parser

// ITextHandler h = new ITextHandler(document);
HtmlParser.Parse(document, "Chap0702.htm");

// step 4: we parse the document _Document;
// h.Parse("Chap0702.htm");
// step 4: we parse the document
// parser.parse("Chap0702.html");

}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
Console.Error.WriteLine(e.StackTrace);
}

}

este es el codigo del boton ke deberia traspasar de html a pdf y me arroja los siguientes errores

Error 1 A local variable named 'e' cannot be declared in this scope because it would give a different meaning to 'e', which is already used in a 'parent or current' scope to denote something else C:\Documents and Settings\Administrador\Mis documentos\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplicati on3\Form1.cs 187 13 WindowsApplication3

Error 2 No overload for 'button3_Click' matches delegate 'System.EventHandler' C:\Documents and Settings\Administrador\Mis documentos\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplicati on3\Form1.Designer.cs 65 35 WindowsApplication3


alguien ke cache ayudeme porfis :)
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:17.