We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Exporting to PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

121015 Nov 3,2015 04:56 AM Jun 21,2016 09:36 AM Windows Forms 8
loading
Tags: GridGroupingControl
Bertuzzi Mario
Asked On November 3, 2015 04:56 AM

Hello,

I tried to export a GGC to PDF following the example given in the installation directory, but the method given permit only to export the TableControl of the Main Table and not the Child Tables.
I would like to know if it was possible to have an export in Landscape format of all the Grid as in the Excel one.

Regards

Solai A L [Syncfusion]
Replied On November 4, 2015 07:19 AM

Hi Bertuzzi,


Thank you for using Syncfusion products.


Our GGC to pdf export supports child exporting. However it has limitation, the child grid width has been limited to parent grid width in the pdf page. Please refer to the attached pdf. By default, the page exports in the landscape only. We have already logged a feature report for this.

Sample:

http://www.syncfusion.com/downloads/support/forum/121015/ze/Sample(4)481698749

Thanks,

AL.Solai.

Bertuzzi Mario
Replied On November 5, 2015 08:49 AM

Hi,

Thanks for the quick answer, I would like to have if possible a sample code for the creator of the PDF attached in your previous message.
About the PDF export only in landscape I have to disagree, since the function export only in Portrait in my code.
Perhaps a sample code would be useful for both of my questions.

Regards


Solai A L [Syncfusion]
Replied On November 6, 2015 01:40 AM

Hi Bertuzzi,

Thank you for your update.

Please refer the below sample containing parent-child table and code example for reference. Please let us know if you have any concerns.

Code Example :

private void button1_Click(object sender, EventArgs e)

        {

            GridPDFConverter pdfConvertor = new GridPDFConverter();


                pdfConvertor.ShowHeader = true;


                pdfConvertor.Margins.All = 25;

                pdfConvertor.ExportToPdf("Sample.pdf", this.groupingGrid1.TableControl);

            //Launching the PDF file using the default Application.[Acrobat Reader]

            System.Diagnostics.Process.Start("Sample.pdf");

        }
Sample :
http://www.syncfusion.com/downloads/support/forum/121015/ze/CS-875020642

Thanks,
AL.Solai.


Solai A L [Syncfusion]
Replied On November 6, 2015 05:09 AM

Hi Bertuzzi,

Please ignore our previous update.

Please refer the below dashboard sample containing parent-child table loaded from Exapand.xml file and code example for reference. Please let us know if you have any concerns.


Code Example :

private void button1_Click(object sender, EventArgs e)

        {

            GridPDFConverter pdfConvertor = new GridPDFConverter();


                pdfConvertor.ShowHeader = true;


                pdfConvertor.Margins.All = 25;

                pdfConvertor.ExportToPdf("Sample.pdf"this.groupingGrid1.TableControl);

            //Launching the PDF file using the default Application.[Acrobat Reader]

            System.Diagnostics.Process.Start("Sample.pdf");

        }

Sample:
http://www.syncfusion.com/downloads/support/forum/121015/ze/CS-1748253704


Thanks,
AL.Solai.



Bertuzzi Mario
Replied On November 10, 2015 04:11 AM

Hi,

Sorry for the late reply, now the PDF print the child tables of my GGC, but still the print is in Portrait (Vertical A4), and the function automatically split the GGC in a certain number of page.
Since you answered me in the first post that the default page exports was in Landscape, I would like to know if there is a work around.

Regards

Solai A L [Syncfusion]
Replied On November 11, 2015 05:30 AM

Hi Bertuzzi,

Thank for your update.

Please find the attachment, the landscape is getting applied properly to the document. Since, the size of grid is more that the bounds of the file, it gets paginated(i.e., the extra part moves to the next page). If you check using a small grid, you can check the orientation clearly. Anyways, if you want to change the orientation, please use the below code.

Code Example :

Method1:


  GridPDFConverter pdfConvertor = new GridPDFConverter();

  PdfDocument pdfdoc = new PdfDocument();

  PdfLayoutFormat format = new PdfLayoutFormat();

  format.Layout = PdfLayoutType.OnePage;

  pdfdoc.PageSettings.Orientation = PdfPageOrientation.Landscape;

pdfConvertor.ExportToPdf(pdfdoc, this.groupingGrid1.TableControl);


Method2 :

pdfConvertor.Exporting += new GridPDFConverter.PDFExportingEventHandler(pdfConvertor_Exporting);

  void pdfConvertor_Exporting(object sender, PDFExportingEventArgs e)

   {

            e.PdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape;

   }
Exported file :
http://www.syncfusion.com/downloads/support/forum/121015/ze/Sample1-1904972378

Thanks,
AL.Solai.


Ruben
Replied On June 20, 2016 11:34 AM

Hi,

 Is posible adjust the width of pdf to view all columns displayed in one page, in my grid the last colums show in other page. Or change the font size etc...

Thanks
 

Piruthiviraj Malaimelraj [Syncfusion]
Replied On June 21, 2016 09:36 AM

Hi Ruben, 

Thank you for using Syncfusion products. 

We don’t have direct support to adjust the page width while exporting  the grid to PDF. In order to resize the column width of the grid while exporting the PDF, Exporting event can be used. In that event , you can customize the page width by using any of the following methods, 
                                              1. Use Width property of PDFDocument  
                                              2. Set the Orientation property as Landscape.  
 
Please make use of below code and refer to the attached sample. 
 
Code snippet: 
 
void pdfConvertor_Exporting(object sender, PDFExportingEventArgs e) 
{ 
     //You can use any of the followings 
     e.PdfDocument.PageSettings.Width = this.gridGroupingControl1.TableModel.ColWidths.GetTotal(0, this.gridGroupingControl1.TableModel.ColCount); 
 
     e.PdfDocument.PageSettings.Orientation = Syncfusion.Pdf.PdfPageOrientation.Landscape;  
} 

Sample link:  

Regards, 
Piruthiviraj 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;