Hi all,
I made an windows service that convert html to pdf like this:
PDFDocument doc = new PDFDocument();
doc.Compression = CompressionLevel.Best;
IPDFGraphicState properties = doc.CreateGraphicState();
properties.SplitImages = true;
properties.BreakBehavior = AutoBreakBehavior.Cropping;
HtmlConverter html = new HtmlConverter();
PointF imageLocation = new PointF(10, y);
Image infoImg = html.ConvertToImage(infoPath, ImageType.Metafile,800);
SizeF imageSize = new SizeF();
if (infoImg != null)
{
if (infoImg.Width > doc.LastPage.DrawingWidth)
{
imageSize = new SizeF(doc.LastPage.DrawingWidth, infoImg.Height);
}
else
{
imageSize = new SizeF(infoImg.Width, infoImg.Height);
}
y = infoImg.Height;
doc.LastPage.Graphics.DrawImage(imageLocation, infoImg, imageSize, properties);
}
On my computer where I have installed Syncfusion and Visual Studio 2005 works fine, but when I move it on the server that have only installed .Net Framework 2.0 and Syncfusion assemblies registered to GAC (syncfusion.htmlui.base.dll, syncfusion.htmlui.windows.dll, syncfusion.compression.base.dll, syncfusion.htmltodls.base.dll, syncfusion.htmlconverter.base.dll, Syncfusion.dls.base.dll, Syncfusion.pdf.windows.dll, Syncfusion.pdf.base.dll, Syncfusion.Schedule.Windows.dll) give the following errors:
System.ArgumentException: Parameter is not valid. at System.Drawing.Image.get_Width() when I try to get the with of the image I suppose
and
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at Syncfusion.Pdf.Implementation.Objects.PDFGraphics.GetMetafileSize(Metafile metaFile)
at Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawMetafileImage(PointF location, IPDFImage image, SizeF destination, IPDFGraphicState properties, RectangleF clipRectangle)
at Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location, IPDFImage image, SizeF destination, IPDFGraphicState properties, RectangleF clipRectangle)
at Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location, Image image, SizeF destination, IPDFGraphicState properties, RectangleF clipRectangle)
at Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location, Image image, SizeF destination, IPDFGraphicState properties)
when I try to draw image into pdf (last line of code).
Can someone help me? There are other assemblies to add to GAC or?
Thank you,
Irina.