Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / Error on EndDoc()
Author Message
TM
# Posted: 20 Jul 2005 19:34


Could not Finalize PDF due to: System.ApplicationException: QUEUECount = 829...Error Code: -2147418113

What is this????

Stanislav
# Posted: 20 Jul 2005 20:11


Hi !

Can you show your code ?

Thank you very much !

Best regards,
Stanislav

TM
# Posted: 20 Jul 2005 20:24


public byte[] FinalizePDF(bool DeleteTempFiles, bool SaveHTMLToDisk)
{
try
{
string sFileName = PDFDoc.FileName;
byte[] memPDFImage;

string StreamOutputFileName = _ProcessingFileDirectory + "\\STREAM_" + _ProcessingGuid + ".PDF";

if(SaveHTMLToDisk)
{
string HTMLFileName = _ProcessingFileDirectory + "\\HTML_" + _ProcessingGuid + ".HTM";

StreamWriter HTMLfs = new StreamWriter(HTMLFileName);
HTMLfs.Write(HTMLString.ToString());
HTMLfs.Close();
}

try
{
PDFDoc.EndDoc();
}
catch (System.Runtime.InteropServices.COMException CE)
{
string HTMLFileName = _ProcessingFileDirectory + "\\HTML_FULLCOULDNOTDOIT.HTML";
StreamWriter HTMLfs = new StreamWriter(HTMLFileName);
HTMLfs.Write(HTMLString.ToString());
HTMLfs.Close();
int QUEUECount = HTMLFileQUEUE.Count ;

if (QUEUECount > 0)
{
for (int i=0; i<QUEUECount; ++i)
{
HTML thishtmlobject = (HTML) HTMLFileQUEUE.Dequeue();
string newfile = _ProcessingFileDirectory + @"\" + i.ToString() + ".html";
StreamWriter thisnewHTMLfs = new StreamWriter(newfile);
thisnewHTMLfs.Write(thishtmlobject.HTMLAsString);
thisnewHTMLfs.Close();
}
}

throw new ApplicationException("QUEUECount = " + QUEUECount.ToString() + "...Error Code: " + CE.ErrorCode.ToString() + "... PDF Com Object Failed. Created " + HTMLFileName + " with file that could not write MESSAGE: "+CE.Message, CE);


}

FileStream fs = File.OpenRead(sFileName);
memPDFImage = ReadFile(fs,32768);
fs.Close();

if(!DeleteTempFiles)
{
System.IO.FileStream iwStream = new System.IO.FileStream(StreamOutputFileName,System.IO.FileMode.CreateNew ,System.IO.FileAccess.Write, System.IO.FileShare.Write);
iwStream.Write(memPDFImage,0,memPDFImage.Length);
iwStream.Close();
}

if(File.Exists(sFileName) && DeleteTempFiles){File.Delete(sFileName);}

// Clean up the Image Files used during processing
if(ImageFilesUsedInProcessing != null)
{
for(int i=0; i < ImageFilesUsedInProcessing.Length; ++i)
{
string FilePath = ImageFilesUsedInProcessing[i];
if(FilePath.Length > 0)
{
if(File.Exists(ImageFilesUsedInProcessing[i])){File.Delete(Imag eFilesUsedInProcessing[i]);}
}
}
}
return memPDFImage;
}
catch (System.Exception EXP)
{
if(File.Exists(PDFDoc.FileName) && DeleteTempFiles){File.Delete(PDFDoc.FileName);}
throw new ApplicationException("Could not Finalize PDF due to: " + EXP.ToString(), EXP);
}
}

TM
# Posted: 20 Jul 2005 21:37


HERE IS THE FULL ERROR LOG MESSAGE:

10:06:07 AM exception caught at 10:06 AM. Message given: Could not Finalize PDF due to: System.ApplicationException: QUEUECount = 829...Error Code: -2147418113... PDF Com Object Failed. Created c:/GP/Application/Build Dependencies/TempTable\HTML_FULLCOULDNOTDOIT.HTML with file that could not write ---> System.Runtime.InteropServices.COMException (0x8000FFFF): List index out of bounds (391)
at PDFCreatorPilot2.piPDFDocumentClass.EndDoc()
at TS.GAL.Model.Correspondance.PDF.FinalizePDF(Boolean DeleteTempFiles, Boolean SaveHTMLToDisk) in C:\GP\Application\Controller\web-controller\Objects\ServiceItems\PDF.c s:line 365
--- End of inner exception stack trace ---
at TS.GAL.Model.Correspondance.PDF.FinalizePDF(Boolean DeleteTempFiles, Boolean SaveHTMLToDisk) in C:\GP\Application\Controller\web-controller\Objects\ServiceItems\PDF.c s:line 387

[b][/b]

Stanislav
# Posted: 21 Jul 2005 10:01


Hi !

Is this exception raised always in 829 ? Can you try to convert HTML_FULLCOULDNOTDOIT.HTML independently - maybe problem exist only when converting this particular file. Please try to identify this.

Thank you very much !

Best regards,
Stanislav

Anonymous
# Posted: 22 Jul 2005 22:59


No, it doesn't always happen in 829. But only when when we are converting many files...in this case it crashed on the 829th file. It seems to only happen between 700 and 1000 files.

Stanislav
# Posted: 23 Jul 2005 11:34


Hi !

Can you make some little app which emulates your application logic ? We can test it and possibly find a solution.

Thank you very much !

Best regards,
Stanislav

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.013

 

Page top