Results 1 to 40 of 66

Thread: [02/03] web app to display tiff to pdf

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    790

    [02/03] web app to display tiff to pdf

    Iam working on a application in asp.net to display tiff images however I realized there is no direct way to do this except thorugh conversion to another file standard like JPEG or PDF. So I came up with this and I get an invalid parameter error. Anyone know what could be the cause of this ? In this case from the below sample code I used tiff to jpeg format. If I figure this out if it is safe to assume that I shoukd be able to do the same for a tiff to pdf conversion.

    Code:
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
            Dim originalimg, thumb As System.Drawing.Image
            
            Dim objConn As SqlConnection = New SqlConnection("server =dummy-SQL;database =x_blah;uid=x_blaise;password=SSSSS")
            objConn.Open()
            Dim ds As DataSet = New DataSet
            Dim dv As DataView
            Dim objCommand As SqlCommand
            Dim objDataAdapter As New SqlDataAdapter
    
    
            objDataAdapter.SelectCommand = New SqlCommand
            objDataAdapter.SelectCommand.Connection = objConn
            objDataAdapter.SelectCommand.CommandText = _
            "SELECT FirstName +''+''+ LastName as Name, SN,Suffix, cast(Floor(cast(Date_Orig as Float)) as Datetime)as Date, Code,record, count,App, Fil, file,page, fullpath from dbo.t_S where hex_Number =  '" & CStr(txtNo.Text) & "'"
            objDataAdapter.Fill(ds, "dbo.x_blah")
            dv = New DataView(ds.Tables("dbo.x_blah"))
    
    
            'dataset filled now populating corresponding text fields'
    
            txtLastName.Text = ds.Tables(0).Rows(0)("Name").ToString()
            txtSN.Text = ds.Tables(0).Rows(0)("SN").ToString()
            txtOrigin.Text = RTrim(ds.Tables(0).Rows(0)("Date").ToString())
            txtApp.Text = ds.Tables(0).Rows(0)("App").ToString()
            txtPageNum.Text = ds.Tables(0).Rows(0)("page").ToString()
            txtPath.Text = ds.Tables(0).Rows(0)("fullpath").ToString()
    
    
    ' now getting ready to view the image in the recordset taken from fullpath '
    
    
            Dim strURL As String = Replace(txtPath.Text, "c:\BloodBank\", "\\nxs-appX\gelatin$\")
            'Dim img As Image = Image.FromFile(strURL)
            Image1.ImageUrl = strURL
            Dim YourImageTifFile As String = Image1.ImageUrl
            Dim bmp As Bitmap = New Bitmap(YourImageTifFile)
            Response.ContentType = "image/jpeg"
            bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
            bmp.Dispose()
    Last edited by Christopher_Arm; May 13th, 2008 at 09:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width