Sign In  Sign Up Live-Chat

PDF saves to 0K file in development after timeout error

Last post 07-04-2008, 8:22 AM by Hans.firefox. 6 replies.
Sort Posts: Previous Next
  •  06-22-2008, 7:33 AM 132446

    PDF saves to 0K file in development after timeout error

    Hi,

    In my Visual Studio 2005 development environment, I receive an "The operation has timed out" error on pdf.Save

    I am puzzled as I am logged in as an Administrator on the machine. I have tried saving to different folders, but I always get the same results. Has anyone heard of this and if so, is there a solution as it is quite unproductive right now. Thanks.
     
  •  06-22-2008, 8:28 AM 132451 in reply to 132446

    Re: PDF saves to 0K file in development after timeout error

    Hi,

    Thank you for considering Aspose.

    Can you please provide the code that can reproduce this error?


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  06-22-2008, 9:21 AM 132456 in reply to 132451

    Re: PDF saves to 0K file in development after timeout error

    Hi, Oddly, this works on our production server, but not on development.

        Sub MakePDFofAllAbstracts()
            'create pdf
            Dim ds As New DataSet
            Dim dt As New DataTable
            Dim dr As DataRow
            Dim AbsID As Integer
            Dim pdfFile As String
            Dim i As Integer

            Dim ret As String
            Dim absBody As String = ""

            Dim licenseFile As String = System.Configuration.ConfigurationManager.AppSettings("BinFolderPath") & "Aspose.Total.lic"

            If System.IO.File.Exists(licenseFile) Then
                'This shows how to license Aspose.Words, if you don't specify a license,
                'Aspose.Words works in evaluation mode.
                Dim license2 As Aspose.Pdf.License = New Aspose.Pdf.License
                license2.SetLicense(licenseFile)
            End If

    ' hardcoded to troubleshoot write problem
            pdfFile = "c:\" & Membership.ApplicationName.ToString & "_AbstractsToGrade" & Profile.FirstName & Profile.LastName
            ' pdfFile = Replace(pdfFile, ".", "")
            pdfFile = Replace(pdfFile, ",", "")
            pdfFile = Replace(pdfFile, "/", "")
            pdfFile = pdfFile & ".pdf"

            dt = Cache("AbstractsToGrade")


            Try

                Dim pdf1 As New Aspose.Pdf.Pdf
               For Each dr In dt.Rows

                    ' get abstract body
                    If dr("AbstractID") IsNot System.DBNull.Value Then
                        Try
                            If InStr(dr("AbstractBody"), ">") > 0 Then
                                absBody = Server.HtmlDecode(dr("AbstractBody"))
                            Else
                                absBody = dr("AbstractBody")
                            End If
                        Catch ex As Exception
                            absBody = ""
                        End Try
                     
                    End If

                    absBody = StripTable(absBody)

                    If absBody IsNot System.DBNull.Value And dr("AbstractID") IsNot System.DBNull.Value And dr("AbstractCategory") IsNot System.DBNull.Value And dr("AbstractTitle") IsNot System.DBNull.Value Then


                        'Add a section into the pdf document
                        Dim sec1 As Section = pdf1.Sections.Add()

                        'Create an image object in the section

                        Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec1)
                        image1.ImageInfo.ImageFileType = ImageFileType.Jpeg
                        image1.ImageScale = 0.6
                        image1.ImageInfo.File = "http://www.isshp2008-washington.org/images/ISSHP-Abstract-Banner.jpg"
                        'Set the type of image using ImageFileType enumeration
                        image1.ImageInfo.ImageFileType = ImageFileType.Jpeg
                        sec1.Paragraphs.Add(image1)

                        'Add a text paragraph into the section
                        Dim t1 As Text = New Text(vbCrLf & "Abstract ID: " & dr("AbstractID").ToString & vbCrLf)
                        t1.TextInfo.FontName = "Arial"
                        t1.TextInfo.FontSize = 10
                        AbsID = dr("AbstractID")

                        Dim t2 As Text = New Text("Abstract Title: " & dr("AbstractTitle").ToString & vbCrLf)
                        t2.TextInfo.FontName = "Arial"
                        t2.TextInfo.FontSize = 10

                        Dim t3 As Text = New Text("Category: " & dr("AbstractCategory").ToString & vbCrLf)
                        t3.TextInfo.FontName = "Arial"
                        t3.TextInfo.FontSize = 10


                        Dim t4 As Text = New Text(absBody)
                        t4.TextInfo.FontName = "Arial"
                        t4.IsHtmlTagSupported = True
                        t4.TextInfo.FontSize = 10

                        sec1.Paragraphs.Add(t1)
                        sec1.Paragraphs.Add(t2)
                        sec1.Paragraphs.Add(t3)
                        sec1.Paragraphs.Add(t4)


                        If dr("UserFormID") IsNot System.DBNull.Value And dr("SubmitterUserID") IsNot System.DBNull.Value And dr("SubmitterMemberID") IsNot System.DBNull.Value Then
                            'ret = ReturnImageAsURL(CInt(dr("UserFormID")), CInt(dr("SubmitterUserID")), CInt(dr("SubmitterMemberID")))
                            ret = ReturnImageAsDisk(CInt(dr("UserFormID")), CInt(dr("SubmitterUserID")), CInt(dr("SubmitterMemberID")))
                            If ret IsNot System.DBNull.Value Then
                                If ret <> "" Then

                                    Dim image2 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec1)
                                    sec1.Paragraphs.Add(image2)


                                    image2.ImageInfo.File = ret
                                    ' image2.ImageScale = 0.5

                                    'image2.ImageInfo.Title = ret
                                    'Set the type of image using ImageFileType enumeration
                                    If InStr(UCase(ret), ".JPG") > 0 Then
                                        image2.ImageInfo.ImageFileType = ImageFileType.Jpeg
                                    End If
                                    If InStr(UCase(ret), ".BMP") > 0 Then
                                        image2.ImageInfo.ImageFileType = ImageFileType.Bmp
                                    End If

                                    If InStr(UCase(ret), ".TIF") > 0 Then
                                        image2.ImageInfo.ImageFileType = ImageFileType.Tiff
                                    End If

                                    If InStr(UCase(ret), ".PNG") > 0 Then
                                        image2.ImageInfo.ImageFileType = ImageFileType.Png
                                    End If

                                    If InStr(UCase(ret), ".GIF") > 0 Then
                                        image2.ImageInfo.ImageFileType = ImageFileType.Gif
                                    End If
                                End If
                            End If

                            sec1.IsNewPage = True

                        End If
                    End If


                    i = i + 1

                Next


                'Save the document
                Try
                    pdf1.Save(pdfFile)

                Catch ex As Exception
                    ret = ex.Message
                    Dim ut As New UtilityFuncs
                    ut.ReportError(System.Reflection.MethodBase.GetCurrentMethod.Name.ToString, ex.Message, Request.Browser.Type.ToString)

                End Try


                If System.IO.File.Exists(pdfFile) Then
                    Button1.Visible = False
                    Dim dlhttp As String = "c:\" & Membership.ApplicationName.ToString & "_AbstractsToGrade" & Profile.FirstName & Profile.LastName & ".PDF"
                    litPDF.Text = "<A HREF=" & Chr(34) & dlhttp & Chr(34) & " target=" & Chr(34) & "_blank" & Chr(34) & "><IMG SRC=" & Chr(34) & "images/icon_pdf.gif" & Chr(34) & " BORDER=" & Chr(34) & "0" & Chr(34) & "> Right Click to Download PDF</A><br>"
                End If


            Catch ex As Exception
                Dim ut As New UtilityFuncs
                ut.ReportError(System.Reflection.MethodBase.GetCurrentMethod.Name.ToString, ex.Message, Request.Browser.Type.ToString)
                litPDF.Text = ex.Message & " " & AbsID.ToString
            End Try

        End Sub
     
  •  06-22-2008, 7:02 PM 132466 in reply to 132456

    Re: PDF saves to 0K file in development after timeout error

    Hi,

    Can you please try building a simple project without Database and see if it works?


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  06-23-2008, 10:55 AM 132578 in reply to 132466

    Re: PDF saves to 0K file in development after timeout error

    Sorry but that is pointless. We need EMERGENCY support at this point - the product does not work. We get time outs on the production server as well as in development environments and we keep getting 0K PDF files that are locked (unable to delete) on the server.
     
  •  06-23-2008, 6:49 PM 132651 in reply to 132578

    Re: PDF saves to 0K file in development after timeout error

    Hi,

    We want to resolve this problem for you ASAP but it is not easy to find the problem from your code. I guess the problem is caused by the web image but I am not sure.

    Can you get any detailed error message when you get timeout error? In my test, when timeout error is get, Aspose.Pdf throws exception and the application is aborted (0K PDF is generated).

    So please make sure the problem is cuased by web image from your side if possible. We will try to modify our code to ignore timeout error. We will send the new dll to you for test soon.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-04-2008, 8:22 AM 134362 in reply to 132651

    Re: PDF saves to 0K file in development after timeout error

    Attachment: Present (inaccessible)
    Hi,

    We have added a bool attribute Image.ImageInfo.IsImageNotFoundErrorIgnored to allow you to control whether to throw out exceptions when requests web image timed out.
    If it is true, image not found error is ignored and throws out no exception. If false(
    Default is false), exceptions will be thrown out when any error occurs. I have attached our latest dll which contains this update. Please try it and let us know if you have any other problems. Thanks for your patience.

    Best regards.

    Hans Zhang
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
View as RSS news feed in XML