• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

export to pdf

I have datagrid of 20 columns, I give click him to export to pdf and it only exports 12 columns. the code to export to pdf if it reads the 20 columns
the component use is: Pintexx.Components.Web.pinPDF
private string PrintResponseView(int viewKey, string themeName, int menuKey)
            StringBuilder htmlForm = new StringBuilder(GetHTMLResponseView(viewKey, headerKey, footerKey, beginingKey, endingKey, fileName, themeName, menuKey));
            pinPDF objPdf = new pinPDF();
        objPdf.Html = htmlForm.ToString();
        objPdf.OutputPath = tempPrintFolder;
        objPdf.Orientation = pinPDF.enOrientation.Landscape;
        objPdf.FileName = fileName;
        objPdf.Unit = pinPDF.enUnit.mm;
            objPdf.MarginLeft = 10;
        objPdf.MarginRight = 10;
            if (!objPdf.Process()) //
            return "Error: " + objPdf.ErrorMessage;
             return tempPrintFolder + fileName; //

      This method return "\\\\\\framework3-shared\\files\\PrintTemp\\621f9b3e-9c13-47d0-ae6f-afdef7e63eb0.pdf"
      I tested several and this it is the result
      1. data not found then  show 20 columns
      2. data found then  show 12 columns or 10 columns or 15 columns, following the registries that must export
        i attach two file
  • 2
3 Solutions

What you are doing is printing the resulting HTML to a pdf.  If the page doesn't load correctly, then there isn't anything you can do (NO DATA).

If it does print correctly, and you aren't getting all the lines, then I suspect it is due to some paging of the results?

The pdf will ONLY show exactly what is on the page.  Perhaps you would be better to use the actual document.response, rather then calling it in your pdf creation?

Alexandre SimõesManager / Technology SpecialistCommented:

I never used that pdf converter control, so I can't help you with it.
What I can do is point you a new way of doing that.

For me, the best way of printing a grid is using a report.
Although I don't like Crystal Reports it comes for free with Visual Studio and comes with the print to PDF functionality out of the box.

The report can be as straight as a list or it can be made a bit more pleasant for the eye.

Alexandre SimõesManager / Technology SpecialistCommented:
Just to clear one thing...

I say: "the best way of printing a grid is using a report"
I mean, "the best way of printing the contents of a grid is using a report"

For the report you pass the grid's datasource, not the grid itself.

This is obvious, I just wanted to make it clear.


Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now