Advertisement
Advertisement
| 04.16.2008 at 08:59AM PDT, ID: 23327699 |
|
[x]
Attachment Details
|
||
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)
|