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. Image for the cookie policy date
close icon

PDF containing tables & charts. Is this possible?

I have to create a PDF that's auto-generated (on the web) daily. I've been auto-generating excel files using xlsIO for several months now but have no experience with any other products in the essential studio so I'm wondering if the type of PDF I need to auto-generate can be accomplished via essential studio.

The PDF is a combination of some basic text tables (as seen in "page 1" of my attached image) and charts (as seen in "page 2" of my attached image).

I was looking at "essential PDF" but it doesn't appear to be able to handle charts such as these. I was also looking at "essential Chart", and noticed it can be exported into a PDF but don't know if I can include my additional text tables into the same PDF file.

So can this type of PDF be accomplished using essential studio? I'll be using the latest version of essential studio and vs.net 2005.

Thanks.

Regards,
-Ryan


samplePDF.zip

1 Reply

MS Mohamed Suhaib Fahad A. Syncfusion Team November 2, 2007 11:35 AM UTC

Hi Ryan,

Thank you for your interests in Syncfusion products.

Yes, you can achieve the results which you are expecting with Syncfusion suite.

Here is the code to add Chart image, text and Table inside the PDF document,

//Create instance for PDF
PdfDocument pdfDoc = new PdfDocument();
//Add pages to the document
pdfDoc.Pages.Add();
pdfDoc.Pages[0].Graphics.DrawImage(PdfImage.FromFile(file), new RectangleF(10, 30, 200, 200));
pdfDoc.Pages[0].Graphics.DrawImage(PdfImage.FromFile(file1), new RectangleF(300, 30,200,200));
pdfDoc.Pages[0].Graphics.DrawImage(PdfImage.FromFile(file1), new RectangleF(10, 230, 200, 200));
pdfDoc.Pages[0].Graphics.DrawImage(PdfImage.FromFile(file), new RectangleF(300, 230, 200, 200));

PdfGraphics g = pdfDoc.Pages[0].Graphics;
//Create a solid
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
//Set the fontPdfFont
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.Helvetica,12);
//Draw the text
g.DrawString("Exporting chart PDF!The chart control can be exported into a PDF file as an image using Essential PDF. The chart control provides APIs to convert it to an image, while Essential PDF lets you insert this image into a Word Document file programatically.", font, brush,new PointF(10,500));
//Create the table
PdfLightTable table = new PdfLightTable();
string[,] array = CreateStringArray(4, 10, 10, 2);
table.DataSource = array;
PdfPage page = pdfDoc.Pages.Add();
//Draw the table inside the PDF document
PdfLayoutResult result = table.Draw(page, new Rectangle(0, 20,300,300));

Please download the sample from the below link for export the chart image to PDF with tables and text as it is in your screenshot

http://websamples.syncfusion.com/samples/PDF.Web/5.2.0.25/F69538_1/main.htm

Please let me know if you have any other queries.

Regards,
Fahad

Loader.
Live Chat Icon For mobile
Up arrow icon