how to release object from thid party dll?
- by Mohamed
hi all,
i'm developing a program to convert RTF to html
i'm using the DLLs found here
http://www.codeproject.com/KB/recipes/RtfConverter.aspx?fid=1458864&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=3427424&fr=1#xx0xx
this dll saves a jpg file from html to a specific folder,
when i run the program, it cinverts the rtf for the first time and saves the images to the folder perfectly
but when i try to convert it again i hace this error
"error a generic error occured in GDI+"
i think this dll use SaveImage method and to avoid this you must release the Image object you created but i can't modify the DLL,
is there is any way to release the object i've created from this dll?
this is my code
RtfVisualImageAdapter imageAdapter = new RtfVisualImageAdapter(
@Application.StartupPath + "\\Program Data\\temp\\{0}{1}",
System.Drawing.Imaging.ImageFormat.Jpeg);
RtfImageConvertSettings imageConvertSettings =
new RtfImageConvertSettings(imageAdapter);
RtfImageConverter imageConverter = new RtfImageConverter(imageConvertSettings);
try
{
IRtfDocument rtfDocument = RtfInterpreterTool.BuildDoc(
ConversionText, imageConverter);
RtfHtmlConverter htmlConverter = new RtfHtmlConverter(rtfDocument);
htmlConverter.Settings.ConvertVisualHyperlinks = true;
htmlConverter.Settings.UseNonBreakingSpaces = true;
this.richTextBoxPrintCtrl2.Text = htmlConverter.Convert();
}
catch (Exception exception)
{
MessageBox.Show(this, "Error " + exception.Message, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}