unable to add text heading in provided example
Hi,
I am using above example code & that one is working fine.
I tried to add heading with in above code with following code but after creating pdf, heading not appearing.
Can some one help to sort out.
Hi Roshan,
To draw text in a layout, we can use PdfTextElement to draw the text and determine the end positions using PdfLayoutResult and then draw the grid. We have created a sample that meets the requirements of adding a text heading to the PDF document before creating the table, and we have attached it for your reference. Please try it on your end and let us know if you require any further assistance.
Code snippet:
//Apply built-in style pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable5DarkAccent6);
//Create a text element with the text and font PdfTextElement textElement = new PdfTextElement("Heading", new PdfStandardFont(PdfFontFamily.TimesRoman, 12)); //Draws the element on the page with the specified page and location PdfLayoutResult result = textElement.Draw(page, PointF.Empty); //Draw the PdfGrid pdfGrid.Draw(page, new PointF(0,result.Bounds.Bottom+10)); |
Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/CSVToPDF-11307241
Kindly use the following UG link for reference,
Working with Text | Syncfusion
Regards,
Jeyalakshmi T
Thanks for replay & code.
Sorry but your provided code is in c#.
i am using vb.net & i am new , unable to convert your code C# to vb.
Please share vb.net code.
Thanks
Roshan
Hi Roshan,
We have created a sample in VB.NET that meets our requirements, and we have attached it for your reference. Please try it on your end and let us know if you require any further assistance.
Code snippet:
'Create a text element with the text And font Dim textElement As New PdfTextElement("Heading", New PdfStandardFont(PdfFontFamily.TimesRoman, 12)) ' Draws the element on the page with the specified page and location Dim result As PdfLayoutResult = textElement.Draw(page, PointF.Empty) 'Draw the PdfGrid pdfGrid.Draw(page, New PointF(0, result.Bounds.Bottom + 10)) |
Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/CSVtoPDF_Sample-1853590553
Regards,
Jeyalakshmi T
- 3 Replies
- 2 Participants
-
RO Roshan
- Aug 13, 2024 12:16 PM UTC
- Aug 15, 2024 12:15 PM UTC