Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Export Gridview to PDF

Export Gridview to PDF

Scheduled Pinned Locked Moved ASP.NET
htmlhelptutorial
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S SamRST

    hi all, i had been n trouble for weeks, to generate Pdf from Gridview. i tried to use iTextsharp, but not found any how to generate Pdf from HTML. Please help me. its urgent. Thanks in Advance.

    P Offline
    P Offline
    PSK_
    wrote on last edited by
    #2

    If you don’t want to use any 3rd party tool for the conversion then try using SSRS report (.rdl file) locally, you can host the report locally (mode=local) in your website and report viewer control will render the pdf file for you.

    Regards, Prakash Kalakoti

    S 1 Reply Last reply
    0
    • P PSK_

      If you don’t want to use any 3rd party tool for the conversion then try using SSRS report (.rdl file) locally, you can host the report locally (mode=local) in your website and report viewer control will render the pdf file for you.

      Regards, Prakash Kalakoti

      S Offline
      S Offline
      SamRST
      wrote on last edited by
      #3

      hi, i used Microsoft report first, but the hosting server is not supporting the same. please help me friend.

      P 1 Reply Last reply
      0
      • S SamRST

        hi, i used Microsoft report first, but the hosting server is not supporting the same. please help me friend.

        P Offline
        P Offline
        PSK_
        wrote on last edited by
        #4

        For RDL report you don’t need it to be hosted somewhere it can run on Local Mode also. RDL file is just a template and can be used locally; you can add an rdl file in you website and set it as a report source for the reportviewer control. Eg

        ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~\Reports\MyReport.rdl");
        DataSet dsReport = … //Fill the dataset
        ReportDataSource rds = new ReportDataSource();
        rds.Name = “MyDataSet”;
        rds.Value = dsReport.Tables[0];
        ReportViewer1.LocalReport.DataSources.Add(rds);

        Check this out Using the ASP.NET 2.0 ReportViewer in Local Mode[^]

        Regards, Prakash Kalakoti

        S 1 Reply Last reply
        0
        • P PSK_

          For RDL report you don’t need it to be hosted somewhere it can run on Local Mode also. RDL file is just a template and can be used locally; you can add an rdl file in you website and set it as a report source for the reportviewer control. Eg

          ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~\Reports\MyReport.rdl");
          DataSet dsReport = … //Fill the dataset
          ReportDataSource rds = new ReportDataSource();
          rds.Name = “MyDataSet”;
          rds.Value = dsReport.Tables[0];
          ReportViewer1.LocalReport.DataSources.Add(rds);

          Check this out Using the ASP.NET 2.0 ReportViewer in Local Mode[^]

          Regards, Prakash Kalakoti

          S Offline
          S Offline
          SamRST
          wrote on last edited by
          #5

          hi, i tried the same first. But unfortunately the hosting server is not supporting Microsoft reporting & its dll's.

          P 1 Reply Last reply
          0
          • S SamRST

            hi, i tried the same first. But unfortunately the hosting server is not supporting Microsoft reporting & its dll's.

            P Offline
            P Offline
            PSK_
            wrote on last edited by
            #6

            Have you tried coping all the reportviewer dll files in the deoloyment server. Long back I faced same issue, because in my local system all required reportviewer dll was registered in GAC and same was not the case with the production server, so I copied all the dll files manually in the prod server which resolved the issue. What error you are getting?

            Regards, Prakash Kalakoti

            S 1 Reply Last reply
            0
            • P PSK_

              Have you tried coping all the reportviewer dll files in the deoloyment server. Long back I faced same issue, because in my local system all required reportviewer dll was registered in GAC and same was not the case with the production server, so I copied all the dll files manually in the prod server which resolved the issue. What error you are getting?

              Regards, Prakash Kalakoti

              S Offline
              S Offline
              SamRST
              wrote on last edited by
              #7

              hi, ya ya ,, u r correct. but, i tried the same also. but, for running the reportviewer dll, we have to give FULL Trust to that, which is not given by the server.

              1 Reply Last reply
              0
              • S SamRST

                hi all, i had been n trouble for weeks, to generate Pdf from Gridview. i tried to use iTextsharp, but not found any how to generate Pdf from HTML. Please help me. its urgent. Thanks in Advance.

                M Offline
                M Offline
                mrcooll
                wrote on last edited by
                #8

                Hi, i faced this issue last month , i think the best way to do convreting html to pdf is to use a component for it try to google it

                S 1 Reply Last reply
                0
                • M mrcooll

                  Hi, i faced this issue last month , i think the best way to do convreting html to pdf is to use a component for it try to google it

                  S Offline
                  S Offline
                  SamRST
                  wrote on last edited by
                  #9

                  can u please suggest me a component and a sample code.

                  M 1 Reply Last reply
                  0
                  • S SamRST

                    can u please suggest me a component and a sample code.

                    M Offline
                    M Offline
                    mrcooll
                    wrote on last edited by
                    #10

                    http://www.asppdf.com/[^] I used this product http://www.html-to-pdf.net/ExpertPDF-HtmlToPdf-Converter.aspx[^]

                    ''' <summary>
                    ''' Convert the HTML code from the specified URL to a PDF document and send the
                    ''' document as an attachment to the browser
                    ''' </summary>
                    ''' <remarks></remarks>
                    Private Sub ConvertURLToPDF(ByVal url As String)

                            Dim urlToConvert As String = url
                            Dim selectablePDF As Boolean = True
                    
                            ' Create the PDF converter. Optionally you can specify the virtual browser 
                            ' width as parameter. 1024 pixels is default, 0 means autodetect
                            Dim pdfConverter As PdfConverter = New PdfConverter()
                            ' set the license key
                            'pdfConverter.LicenseKey = "put your license key here"
                            ' set the converter options
                            pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4
                            pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal
                            pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait
                    
                            ' set if header and footer are shown in the PDF - optional - default is false 
                            pdfConverter.PdfDocumentOptions.ShowHeader = False
                            pdfConverter.PdfDocumentOptions.ShowFooter = False
                            ' set to generate a pdf with selectable text or a pdf with embedded image - optional - default is true
                            pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = True
                            ' set if the HTML content is resized if necessary to fit the PDF page width - optional - default is true
                            pdfConverter.PdfDocumentOptions.FitWidth = True
                    
                            ' set the embedded fonts option - optional - default is false
                            pdfConverter.PdfDocumentOptions.EmbedFonts = False
                            ' set the live HTTP links option - optional - default is true
                            pdfConverter.PdfDocumentOptions.LiveUrlsEnabled = True
                    
                    
                            ' set if the JavaScript is enabled during conversion to a PDF with selectable text 
                            ' - optional - default is false
                            pdfConverter.ScriptsEnabled = False
                            ' set if the Active
                    
                    S 1 Reply Last reply
                    0
                    • M mrcooll

                      http://www.asppdf.com/[^] I used this product http://www.html-to-pdf.net/ExpertPDF-HtmlToPdf-Converter.aspx[^]

                      ''' <summary>
                      ''' Convert the HTML code from the specified URL to a PDF document and send the
                      ''' document as an attachment to the browser
                      ''' </summary>
                      ''' <remarks></remarks>
                      Private Sub ConvertURLToPDF(ByVal url As String)

                              Dim urlToConvert As String = url
                              Dim selectablePDF As Boolean = True
                      
                              ' Create the PDF converter. Optionally you can specify the virtual browser 
                              ' width as parameter. 1024 pixels is default, 0 means autodetect
                              Dim pdfConverter As PdfConverter = New PdfConverter()
                              ' set the license key
                              'pdfConverter.LicenseKey = "put your license key here"
                              ' set the converter options
                              pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4
                              pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal
                              pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait
                      
                              ' set if header and footer are shown in the PDF - optional - default is false 
                              pdfConverter.PdfDocumentOptions.ShowHeader = False
                              pdfConverter.PdfDocumentOptions.ShowFooter = False
                              ' set to generate a pdf with selectable text or a pdf with embedded image - optional - default is true
                              pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = True
                              ' set if the HTML content is resized if necessary to fit the PDF page width - optional - default is true
                              pdfConverter.PdfDocumentOptions.FitWidth = True
                      
                              ' set the embedded fonts option - optional - default is false
                              pdfConverter.PdfDocumentOptions.EmbedFonts = False
                              ' set the live HTTP links option - optional - default is true
                              pdfConverter.PdfDocumentOptions.LiveUrlsEnabled = True
                      
                      
                              ' set if the JavaScript is enabled during conversion to a PDF with selectable text 
                              ' - optional - default is false
                              pdfConverter.ScriptsEnabled = False
                              ' set if the Active
                      
                      S Offline
                      S Offline
                      SamRST
                      wrote on last edited by
                      #11

                      if u dont mind, can u please give the Dll too. When i use, which i downloaded from google, shows a Red watermark in the pdf file.

                      modified on Wednesday, March 24, 2010 5:13 AM

                      M 1 Reply Last reply
                      0
                      • S SamRST

                        if u dont mind, can u please give the Dll too. When i use, which i downloaded from google, shows a Red watermark in the pdf file.

                        modified on Wednesday, March 24, 2010 5:13 AM

                        M Offline
                        M Offline
                        mrcooll
                        wrote on last edited by
                        #12

                        hi, I think u receiving the watermark on the converted pdf becouse it not license u need to buy it my friend i used this commponent for demo perpose before buy it and install it on the server http://jib.imagine.com.jo/JordanataGlance/tabid/63/language/en-US/Default.aspx[^]

                        S 1 Reply Last reply
                        0
                        • M mrcooll

                          hi, I think u receiving the watermark on the converted pdf becouse it not license u need to buy it my friend i used this commponent for demo perpose before buy it and install it on the server http://jib.imagine.com.jo/JordanataGlance/tabid/63/language/en-US/Default.aspx[^]

                          S Offline
                          S Offline
                          SamRST
                          wrote on last edited by
                          #13

                          There is lots dll, for purhcase. but we r looking for opensource only.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups