Foros del Web » Programando para Internet » ASPX (.net) »

Problema ASPPDF

Estas en el tema de Problema ASPPDF en el foro de ASPX (.net) en Foros del Web. Tenemos un problema al utilizar un patrón factory que devuelve un objeto de asppdf. Mirad cómo se las gasta su servicio técnico: From: Peter Persits ...
  #1 (permalink)  
Antiguo 27/03/2008, 11:09
 
Fecha de Ingreso: marzo-2008
Mensajes: 3
Antigüedad: 16 años, 1 mes
Puntos: 0
Problema ASPPDF

Tenemos un problema al utilizar un patrón factory que devuelve un objeto de asppdf. Mirad cómo se las gasta su servicio técnico:

From: Peter Persits [mailto:[email protected]]
Sent: jueves, 27 de marzo de 2008 16:31
To: Subject: Re: AspPDF: Problem when concurrently accessing Doc.Fonts


I gave you a solution that worked, apparently. My 20-year programming experience teaches me your code is wrong. If you think your code is correct but my product is bad, it's your right.

----- Original Message -----

From:
To: Peter Persits

Sent: Thursday, March 27, 2008 11:24 AM

Subject: RE: AspPDF: Problem when concurrently accessing Doc.Fonts



Well, we are pretty sure that It is NOT illegal to return an object from a method the way we are doing it (factory pattern). Actually we have a lot of classes that work like that and we have no problem with them. Can you have a look to see why its giving problems with ASPPDF?
  #2 (permalink)  
Antiguo 27/03/2008, 11:28
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 22 años, 3 meses
Puntos: 146
Re: Problema ASPPDF

Me no entender

¿Deseas que movamos este tema al foro de Asesoria Legal o hay un problema con un código ASP o cuál es el objeto de este mensaje?

Saludos
  #3 (permalink)  
Antiguo 27/03/2008, 11:54
 
Fecha de Ingreso: marzo-2008
Mensajes: 3
Antigüedad: 16 años, 1 mes
Puntos: 0
Re: Problema ASPPDF

La verdad es que era un poco de las dos cosas. No sabemos si alguien más tiene un problema empleando un patrón factory para devolver un objeto asppdf, cuando se emplea la librería de forma concurrente y, por otra parte, no sabemos muy bien qué posibilidades tenemos antes una respuesta de este tipo por parte del proveedor.
  #4 (permalink)  
Antiguo 27/03/2008, 11:56
 
Fecha de Ingreso: marzo-2008
Mensajes: 3
Antigüedad: 16 años, 1 mes
Puntos: 0
Re: Problema ASPPDF

Perdón, acabo de caer en la cuenta de que nos hemos dejado parte del hilo de conversación con Persits Software:

--------------------------------------------------

Hello again Peter


We were trying to determine what was the difference between your code and our code, and the difference we’ve find is that instead of calling new PdfManager we call the static method that does the new PdfManager…

With this code:



public static IPdfManager GetPdfManager() {

return new PdfManager();

}





private void Page_Load(object sender, System.EventArgs e) {

IPdfManager objPDF = GetPdfManager();

// Create new document

IPdfDocument objDoc = objPDF.OpenDocument( HttpContext.Current.Server.MapPath("files\\4933203 155422655000000.pdf"), Missing.Value);



IPdfFont objFont = objDoc.Fonts["Arial", Missing.Value];



String strText = "dfs";



foreach( IPdfPage objPage in objDoc.Pages ) {

objPage.Canvas.DrawBarcode("1234567890123", "x=10; y=200; width=200; height=10; type=3; DrawText=True" );

}

String strPath = HttpContext.Current.Server.MapPath( "files") + "\\" + HttpContext.Current.Session.SessionID + ".pdf";

String strFileName = objDoc.Save( strPath, false );

objDoc.Close();
}


And run it for 2.5 minutes and 10 threads we got 2835 files and 2 errors like this one

Unhandled Execution Error
Object reference not set to an instance of an object.
at ASPPDFLib.IPdfCanvas.DrawBarcode(String Data, Object Param)
at BreakAspPdf.WebForm5.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

It seems there’s a problem when calling the “new PdfManager” within a static method… Why would this be a problem???



Thanks
  #5 (permalink)  
Antiguo 27/03/2008, 12:07
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 22 años, 3 meses
Puntos: 146
Re: Problema ASPPDF

Bueno, con ese código que pegas me doy cuenta que el problema es de ASP.NET, así que te muevo para allá, aunque no se si el moderador de .NET decida moverlo al foro de OOP

Saludos
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 06:17.