Advertisement

04.16.2008 at 08:59AM PDT, ID: 23327699
[x]
Attachment Details

Intermittent problem with PDF creation in VB .NET, IE security settings issue?

Asked by Laura_Nash in .NET Framework 2.0, Microsoft Visual Basic.Net, Internet Explorer Web Browser

Tags: Microsoft, Internet Explorer, IE6, .NET Framework, VB .NET, IE6, Internet explorer cannot download ..[QueryString] from [Server]. Internet Explorer cannot open this Internet site. The requested site is either unavailable or cannot be found. Please try again late, PDF SyncFusion

I'm having a frustrating, intermittent fault when creating pdf's in VB .NET.  It's not actually my code (I've taken the project over from a different developer), but I can't see anything wrong with.  It's using SyncFusion Essential Studio Essential PDF (http://www.syncfusion.com/support/kb/pdf/Default.aspx) for the actual pdf creation.  I have a fault raised with them for this, but they seem to have dried up on ideas, so I'm hoping it's not directly related to a bug in their code but something I can fix myself.

I am trying to create a pdf of a complex, scorecard web page created using a GridView.  I'm creating it as an image because the GridView has a lot of formatting applied to it (hidden columns, merged cells etc) that would be hard to re-create in something like a pdf table.

The code works fine sometimes, and not others.  I have been unable to trace any particular reason for this.  It does not seem to depend on the user or PC, the same user can have it work one minute and not the next.  It does seem to be less likely to work after the server has been re-booted or the app re-published.  Generally it will work or not work for some time (i.e. the user will have a day of it not working and then it will suddenly start to work fine, two days later it will suddenly stop working again).  The user can always access the URL directly that it is trying to convert to pdf, and when it's not working I can change the URL that is being converted to anything (e.g. the bbc site) within the page and it still won't work, so I don't think it relates to a problem with the page that generates the scorecard.

When it doesn't work, the user gets the error message:

Internet explorer cannot download ..[QueryString] from [Server].  Internet Explorer cannot open this Internet site.  The requested site is either unavailable or cannot be found. Please try again later

Once for each page that it is trying to create.  They then get prompted to open the pdf as usual, but once opened it is blank (there are the correct number of pages, but each is blank).  I'm thinking this must relate to the access to the local cache directory in some way?  I have tried unchecking 'Do not save encrypted files to disk' in IE Advanced Options, and (at SyncFusion's suggestion) changing the IE DCOM security settings on the local PC to allow User full permissions, but neither helped.

Any suggestions would be very gratefully received.

LauraStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
For PageID = 0 To No_of_pages - 1
 
Dim img As System.Drawing.Image
 
Using html As New HtmlConverter()
 
    img = html.ConvertToImage(strtext, ImageType.Bitmap, 1072, 350)
    'strtext contains the URL to the aspx file, plus the query string
 
        Try
            If Not img Is Nothing Then
 
               If img.Size.Width > pageSize.Width Then
                 'Bitmap
               Dim image As PdfImage = New PdfBitmap(img)
               Dim format As PdfLayoutFormat = New PdfLayoutFormat()
               format.Break = PdfLayoutBreakType.FitPage
               format.Layout = PdfLayoutType.Paginate
               image.Draw(page, New RectangleF(0, 0, pageSize.Width, pageSize.Height), format)
 
              Else
              'Bitmap
              Dim image As PdfImage = New PdfBitmap(img)
              Dim format As PdfLayoutFormat = New PdfLayoutFormat()
              format.Break = PdfLayoutBreakType.FitPage
              format.Layout = PdfLayoutType.Paginate
              image.Draw(page, New RectangleF(0, 0, img.Width, img.Height), format)
           End If
              Else
              Response.Write("Warning ! Please check the HTML link")
           End If
 
           Catch ex As Exception
                 lblUserMessages.Text = ex.ToString
     End Try
 
End Using
 
If PageID < No_of_pages - 1 Then
     ' Add page
      page = doc.Pages.Add()
End If
 
Next PageID
Dim pdffile As String
 
pdffile = "Scorecard" & lstScorecard.SelectedValue.Trim & lstYear.SelectedValue.Trim & lstMonth.SelectedValue.Trim & lstMonthsToShow.SelectedValue.Trim & ".pdf"
 
doc.Save(pdffile, Response, HttpReadType.Save)
 
Loading Advertisement...
 
[+][-]04.20.2008 at 06:22AM PDT, ID: 21395943

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET Framework 2.0, Microsoft Visual Basic.Net, Internet Explorer Web Browser
Tags: Microsoft, Internet Explorer, IE6, .NET Framework, VB .NET, IE6, Internet explorer cannot download ..[QueryString] from [Server]. Internet Explorer cannot open this Internet site. The requested site is either unavailable or cannot be found. Please try again late, PDF SyncFusion
Sign Up Now!
Solution Provided By: active_agent
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.21.2008 at 12:12AM PDT, ID: 21399269

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 06:40AM PDT, ID: 21453822

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628