Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/03/2008, 11:56
persits
 
Fecha de Ingreso: marzo-2008
Mensajes: 3
Antigüedad: 16 años, 9 meses
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