We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Parameter is not Valid

I am in the process of evaluating sync fuction PDF generation library. I have a simple web asp.net app (asp.net 2.0) where I put an image int the cache object at the time of application start. the page_load method simply creates the PDF and uses the images as a water mark. My code is pdfDoc.LastPage.Graphics.DrawWatermark((System.Drawing.Image) Cache["logo"], WatermarkImageType.Stretched); When I run the code for the first time everything works fine. however when I run it from visual studio 2005. on the first run everything works fine and I get the desired behaviour. If I close the browser and run it again I get an error ------------------ System.ArgumentException: Parameter is not valid. [ArgumentException: Parameter is not valid.] System.Drawing.Image.get_FrameDimensionsList() +133 Syncfusion.Pdf.Implementation.Objects.PDFImage.InitializeObject() +374 Syncfusion.Pdf.Implementation.Objects.PDFImage..ctor(IPDFDocument document, Image image) +155 Syncfusion.Pdf.Implementation.Utilities.PDFImagesFactory.CreateImage(IPDFDocument document, Image image) +140 Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawWatermark(Image image, WatermarkImageType type) +150 _Default.Page_Load(Object sender, EventArgs e) in c:\SyncFusionPrototype\Default.aspx.cs:29 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68 System.Web.UI.Control.OnLoad(EventArgs e) +88 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint ------------------- I also deployed the app on IIS 5.1 (win xp sp2) and got the same error. first time the app works fine. If I access it the second time I get the same error. Kindly revert to me urgently on this issue because this will help me in evaluating the library. Also, have you done any performance testing on this library. If yes, could you share the data with us, because we are evaluating it for a customer who will have very large number of hits on their site. regards, Abhishek.

5 Replies

AJ Ajish Syncfusion Team May 10, 2006 06:32 AM UTC

Hi Abhishek., Thank you for your interest in Essential PDF and Sorry for the delay in getting back to you. I am afraid I was not able to reproduce this issue. I tested this issue using the following sample WaterMark.zip Could you please take a look at the sample and let me know of any differences in your pdf generation from the above sample. If the problem still exists can you please modify this sample and send so that I can investigate further on this issue. Thanks, Ajish.


AB Abhishek May 16, 2006 10:49 AM UTC

My code is not very different from yours. Here it is PDFDocument pdfDoc = new PDFDocument(); pdfDoc.Margins = new PDFPadding(0); pdfDoc.LastPage.Orientation = PageOrientation.Landscape; IPDFFont pdfFont = pdfDoc.Fonts.Add(new System.Drawing.Font("Arial", 10)); pdfFont.Size = 10; System.Drawing.Image img = Cache["logo"] as System.Drawing.Image; pdfDoc.LastPage.Graphics.DrawWatermark(img, WatermarkImageType.Stretched); string[] lines = (string[])Cache["text"]; pdfDoc.LastPage.Graphics.DrawMultiText(321, 182, pdfDoc.LastPage.DrawingWidth, pdfDoc.LastPage.DrawingHeight, string.Format(lines[0], 12345), pdfFont); System.Drawing.Font f = pdfFont.ToSystemFont(); pdfDoc.LastPage.Graphics.DrawMultiText(113, 365, pdfDoc.LastPage.DrawingWidth, pdfDoc.LastPage.DrawingHeight, lines[3], pdfFont); pdfDoc.Save("Sample.pdf", Response, HttpReadType.Open); // calling dispose doesn''t resolve the problem //pdfDoc.Dispose(); pdfDoc = null; } > >Hi Abhishek., > >Thank you for your interest in Essential PDF and Sorry for the delay in getting back to you. I am afraid I was not able to reproduce this issue. I tested this issue using the following sample > >WaterMark.zip > >Could you please take a look at the sample and let me know of any differences in your pdf generation from the above sample. If the problem still exists can you please modify this sample and send so that I can investigate further on this issue. > >Thanks, >Ajish. >


AJ Ajish Syncfusion Team May 16, 2006 11:45 AM UTC

Hi Abhishek, I am afraid I need some more information to answer this question. Can please clarify your question with some details given below. 1) Are you able to run the sample that I send to you in the previous post? [If not what exactly the problem that you are facing] 2) Are you getting some compile errors or runtime errors [If so can you send the details of the error] We will try to resolve your problem as soon as possible. Thanks, Ajish.


AB Abhishek May 16, 2006 06:56 PM UTC

I was able to simulate the problem in your prototype. In your sample, you always populate the cache with the image by reading it from the file. Which kind of defeats the purpose of caching. If I change your code to If (Cache["Image"] != null) { Cache.Insert("Image", Image.FromFile(Server.MapPath("PDFDemo.bmp")); } then your sample also gets the error on second run. Please note that 1) I am on VS.NET 2005, .NET 2.0 2) I use BMP and not JPEG as my watermark. >Hi Abhishek, > >I am afraid I need some more information to answer this question. Can please clarify your question with some details given below. > >1) Are you able to run the sample that I send to you in the previous post? [If not what exactly the problem that you are facing] > >2) Are you getting some compile errors or runtime errors [If so can you send the details of the error] > >We will try to resolve your problem as soon as possible. > >Thanks, >Ajish. >


AJ Ajish Syncfusion Team May 18, 2006 09:36 AM UTC

Hi Abhishek, Sorry for the delay in getting back to you. I was able to reproduce the issue. I will consult with the development team regarding this issue and send you an update soon. Thanks, Ajish.

Loader.
Live Chat Icon For mobile
Up arrow icon