Error on using DrawToWeb

Error on using DrawToWeb

Forum member · Mar 29, 2006
Dear all, i have a problem in using the DrawToWeb - Method in an Asp.Net 2.0 Application. When runing: document.DrawToWeb(this, "pdf_zeit"); it says: <<System.ArgumentOutOfRangeException was unhandled by user code << Message="Specified argument was out of the range of valid <<values.\r\nParameter name: offset" << Source="System.Web" << ParamName="offset" << StackTrace: << at System.Web.HttpResponseStream.Write(Byte[] buffer, <<Int32 offset, Int32 count) << at ceTe.DynamicPDF.IO.DocumentWriter.Write(String text) << at ceTe.DynamicPDF.IO.DocumentWriter.WriteUnicodeText <<(String textBefore, String text, String textAfter) << at ceTe.DynamicPDF.IO.DocumentWriter.b() << at ceTe.DynamicPDF.IO.DocumentWriter.h() << at ceTe.DynamicPDF.Document.a(Page A_0, Boolean A_1, <<String A_2, Boolean A_3, Assembly A_4) << at ceTe.DynamicPDF.Document.DrawToWeb(Page page, String << downloadAsFileName) Do you have any advice for me? Thanks very much!

Re: Error on using DrawToWeb

Support · Mar 29, 2006
This is a general error that could be caused by many different things. Typically however it can be caused by an erroneous or problematic Image or maybe a Font file (these are not exclusive causes for this however). Are you using any particular Images or Fonts that you can narrow this exception to? If so, send it (them) over to us in an email, [^a|mailto:support@cete.com|support@cete.com^]. Actually, one additional thing you can do before sending anything over is to make sure that you are using the very latest version of our dll files (if you are evaluating check the latest version on the download page or if you have a license check the latest version in the Customer Area Download the latest version and test the applicatin again. This will assure that this is not related any already addressed issues. If after that you are still having trouble then send over any resources (images, fonts, etc.) you are having trouble with. Thanks, ceTe Software Support Team

Re: Error on using DrawToWeb

Forum member · Jul 8, 2006
I get the same error in my webapp. I found that as soon as i add one of the following commented line in the code i get this offset ArgumentOutOfRangeException. ceTe.DynamicPDF.Document document = new ceTe.DynamicPDF.Document(); document.Creator = "TEST"; //document.Author = autorName; //document.Title = title; document.PdfVersion = PdfVersion.v1_6; document.CompressionLevel = 8; //document.Subject = "generated by " + userName; document.InitialPageZoom = PageZoom.FitWidth; //document.Security = new ceTe.DynamicPDF.StandardSecurity(); //document.Security.AllowEdit = false; //document.Security.AllowUpdateAnnotsAndFields = false; //document.Security.AllowCopy = false; The real funny thing is. It all work on my local development machine but it doesnt on the live web server. On both machines i use V3.0.3. What's the problem with that?

Re: Error on using DrawToWeb

Support · Jul 10, 2006
Hello, Since it is working for you on your development machine and not on your live production server, the likely cause of the error is that your development machine and your license server have reference to different build DLL files. To verify this in Visual Studio highlight one of the DynamicPDF references, and then go to the properties window, and mouse over the Description. This will display the actual build number. Make sure that your development machine and the live server are using the exact same DLL files. Thanks, ceTe Software Support Team

Re: Error on using DrawToWeb

Forum member · Aug 12, 2006
I'm using the DrawToWeb method but when I try to open the pdf document generated I received an error: "there was an error opening this document. The file is damaged and could not be repaired" But if I open the same document saved on my hard disk it opens without problems.. Help me Valentina

Re: Error on using DrawToWeb

Support · Aug 14, 2006
Hello Valentina, This is most likely happening because there is some stray HTML being output after the PDF stream is getting created. The easiest solution is to add a Response.End() directly after the Document objects DrawToWeb method or by removing the extra HTML tags. Thanks, ceTe Software Support Team

Re: Error on using DrawToWeb

Forum member · Aug 29, 2006
I am having the same problem: ie: Specified argument was out of the range of valid values. Parameter name: offset, when trying to DrawToWeb(me,"MyPDF.pdf") The version of the dll is build 60404 and I tried the Response.end but no luck. I just converted this project from vs2003 to vs2005. The old project worked fine. Thanks, Stu

Re: Error on using DrawToWeb

Support · Aug 29, 2006
Hey Stu, Make sure you are using the latest build. Log into the Customer Area and download the latest dll from there. Thanks, ceTe Software Support Team

Re: Error on using DrawToWeb

Forum member · Aug 29, 2006
I'm using DynamicPDF400forNETCommunityAndEvaluationEditionBuild60404. I checked and this is the latest build.

Re: Error on using DrawToWeb

Forum member · Sep 12, 2006
I am having the same problem. "Specified argument was out of the range of valid values. Parameter name: offset, when trying to doc.DrawToWeb(this). The version of the dll is version 3.0.3 build 50611. I just converted this project from vs2003 to vs2005. The old project worked fine. -Justin

Re: Error on using DrawToWeb

Forum member · Sep 12, 2006
I upgraded to build 51220, but the problem persists. -Justin

Re: Error on using DrawToWeb

Forum member · Jun 26, 2008
I had the problem with "There was an error opening this document. The file is damaged and could not be repaired". I opened the PDF-file with Notepad and saw a lot of HTML. A Response.End() after the DrawToWeb-method solved my problem. The DrawToWeb-method still have this bug in version 5.0.0 build 10626.

Re: Error on using DrawToWeb

Support · Jun 26, 2008
Hello, This is not a bug in our product. If you have any stray HTML then it will be added to the response stream and this causes the problem. You can add the following line right after to DrawToWeb method to stop the stray HTML getting added. Visible = false; Thanks, ceTe Software Support Team.