Unable to use a VB.Net Calendar control (bug?)

Unable to use a VB.Net Calendar control (bug?)

Forum member · Apr 10, 2006
I'm using VS 2003 to create a sample PDF file for testing. Using the following HTML: <%@ Page Language="vb" codebehind="PDFTestb.aspx.vb" Inherits="Access.HelloWorldb" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>CRMReports</title> </HEAD> <body> <form runat="server"> <table> <tr valign="top"> <td></td> <td width="10"></td> <td></td> </tr> </table> </form> </body> </HTML> _____________________________________________ and the following VB.Net code in the Page_Load event handler... Dim MyPDFDoc As New ceTe.DynamicPDF.Document Dim i As Short Dim MyPage As ceTe.DynamicPDF.Page Dim MyTextBlock As ceTe.DynamicPDF.PageElements.Label For i = 1 To 10 MyPage = New ceTe.DynamicPDF.Page(PageSize.Letter, PageOrientation.Portrait, 54) MyTextBlock = New ceTe.DynamicPDF.PageElements.Label("This is page " & i & vbCrLf & " -Elroyskimms", 10, 10, 300, 100, ceTe.DynamicPDF.Font.TimesRoman, 12) MyPage.Elements.Add(MyTextBlock) MyPDFDoc.Pages.Add(MyPage) Next MyPDFDoc.DrawToWeb("SamplePDF.pdf", True) _____________________________________________ Everything works great. If I add the following tag to the first empty cell in the HTML table: <asp:Calendar id="Calendar1" runat="server"> </asp:Calendar> _____________________________________________ The PDF cannot be opened. The error message (in Reader 7.0.7) says "There was an error opening this document. The file is damaged and cannot be repaired." A similar error message appears in Reader 6.05 and Acrobat Standard 6.05. If I remove the Calendar element from the HTML, the problem goes away. Any ideas?

Re: Unable to use a VB.Net Calendar control (bug?)

Support · Apr 10, 2006
Hello, This is most likely happening because there is some HTML being output or appeneded to the content stream after the PDF has been created. Different versions of acrobat respond differently to this. The easiest solution is to add a Response.End() directly after the Document's DrawToWeb method. Thanks ceTe Software Support Team

Re: Unable to use a VB.Net Calendar control (bug?)

Forum member · Apr 10, 2006
Thanks! That worked. What is it about the Calendar control that is not compatible with a PDF file? I tried a few other controls and this problem did not happen. Even the sample code I downloaded from your website wrote the HTML output to the PDF file, but the viewers were able to handle them properly.

Re: Unable to use a VB.Net Calendar control (bug?)

Support · Apr 10, 2006
Hello, There are no compatibility issues between using any controls and the PDF file. You can not output any HTML text after the PDF output stream and that’s the reason you add Response.End() to take care of any HTML text on the aspx page. Different versions of Acrobat would handle this differently. Can you please tell us which example on our web site, you are referring to because we do have Response.End() for each of our examples that have HTML text on the ASPX page. Thanks, ceTe Software Support Team

Re: Unable to use a VB.Net Calendar control (bug?)

Forum member · Apr 10, 2006
The sample I used did not have any HTML content which is probably why it worked and my code did not. As a suggestion for stupid users such as myself, may I recommend that the Response.End() line be added to all of your samples (even those without HTML). A single comment line could instruct the user to use or not use that line depending on the presence of HTML. Thanks again for your help, and thanks for adding these support forums.