Unable to Download the PDF from our Applicaiton after Converting from HTML to PDF

We are converting HTML to PDF and then trying to download the PDF file with HTTP , But we are unable to download , it displaying the button "Retry" , "Cancel" , "ViewDownloads" instead of "Open" button. This is really frustrating I have sent an Email to Support attaching the couple of issues. Please review the issues do the needful ASAP FROM: Madhusudan.d@inteqsolutions.com Thanks!
asked 10/4/2018 12:24:24 PM
add a comment

1 Answers

Hello, It looks like our email did not show in your normal inbox. We asked for license info (e.g Order# or purchaser email) since we could not find your license on our system. Please send that info to support@componentpro.com
answered 10/5/2018 9:28:18 PM
  Already sent the email to support support@componentpro.com for the below errors. Waiting for reply. After including the new ComponentPro dll, we are getting the .Net Build Errors as shown below . Please provide us the sample codes for the new Dll to implement the same . We are converting the HTML String to PDF and then downloading the PDF as attachment using HTTP Response. Below are methods called for this doc.ImportHtmlText(page, htmlText, options) doc.Save(OutputFile, Response, HttpResponseType.SaveAsAttachment) warning BC40056: Namespace or type specified in the Imports 'ComponentPro.HtmlConverter' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. error BC30002: Type 'AspectRatio' is not defined. error BC30451: 'AspectRatio' is not declared. It may be inaccessible due to its protection level. error BC30002: Type 'Html2PdfOptions' is not defined. error BC30456: 'ImportHtmlText' is not a member of 'ComponentPro.Pdf.PdfDocument'. error BC30451: 'HttpResponseType' is not declared. It may be inaccessible due to its protection level. The existing code is as shown below . This codes gets build error after applying the new Dll Public Function CreatePdfFromHTML(ByVal htmlText As String, ByVal OutputFile As String) As Boolean Try Dim doc As PdfDocument Dim objLetterTmp As New List(Of Letters_Template) Dim colLtrTemplare As New List(Of Letters_Template) Dim TemplateKey As Integer = 0 Dim Uploadedtime As String Dim MyDAte As DateTime Dim Status As String = String.Empty Dim strScript As String = String.Empty MyDAte = DateTime.Now.ToString() Uploadedtime = MyDAte.Year.ToString() & MyDAte.Month.ToString("D2") & MyDAte.Day.ToString("D2") + "_" + MyDAte.Hour.ToString() & MyDAte.Minute.ToString() & MyDAte.Second.ToString() Dim _FileExtention As String = ".pdf" Dim _LettersFilePath As String Dim TotalResArray() As String doc = New PdfDocument() doc.PageSettings.Margins.All = 43 'Set page orientation doc.PageSettings.Orientation = PdfPageOrientation.Portrait 'Set rotation doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle0 'Add a page Dim page As PdfPage = doc.Pages.Add() Dim pageSize As SizeF = page.GetClientSize() Dim convertor As New PdfUnitConvertor() Dim width As Single = -1 Dim height As Single = -1 'Calculates the height and width of the pdf image Dim dimension As AspectRatio = AspectRatio.None dimension = AspectRatio.KeepWidth width = convertor.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point) 'End If Dim s As Long = DateTime.Now.Ticks Dim options As New Html2PdfOptions() options.EnableJavaScript = True options.AutoDetectPageBreak = True options.EnableHyperlinks = True options.Width = CInt(Fix(width)) options.Height = CInt(Fix(height)) options.SplitTextLines = True options.AspectRatio = dimension If (htmlText <> "") Then doc.ImportHtmlText(page, htmlText, options) End If Dim filePath As String = String.Empty _LettersFilePath = hdnFilePath.Value TotalResArray = PDFLetterName.Split("|") Dim tempPath As String = System.IO.Path.GetTempPath() Dim ViewSp As String = String.Empty If TotalResArray.Count > 1 Then obj_Ltr_PDFNames = PDFLetterName ViewSp = hdnnviewtype.Value Return True Else OutputFile = OutputFileName OutputFile = name + ".pdf" doc.Save(OutputFile, Response, HttpResponseType.SaveAsAttachment) End If Catch ex As Exception Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "PresentationLayerPolicy") If rethrow Then Throw End If Richard Dotson 10/11/2018 7:18:35 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged pdf or ask your own question.