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

PDF ASP.NET

Hi,

I am creating a list of table data by using the PDFLightTable. All is working fine, but now I want to insert a pagebreak, when the employee (column(5)) in the table changes. How can I do that?

To draw the list I use the command

table.Draw(page, rect, format)

Thanks

9 Replies

TE Thiruvenkadam E Syncfusion Team September 28, 2009 02:41 PM UTC

Hi Erich,

Thank you for your interest in Syncfusion products.

If your intention is to paginate the PdfLightTable,it can be achieved by setting the format.Layout as PdfLayoutType.Paginate.

Kindly refer the below code snippet.

//Use DataTable as source
PdfLightTable table = new PdfLightTable();
//Set layout properties
PdfLayoutFormat format = new PdfLayoutFormat();
format.Break = PdfLayoutBreakType.FitElement;
format.Layout = PdfLayoutType.Paginate;
//Draw table
table.Draw(page, PointF.Empty, format);
doc.Save("Sample.pdf");


Could you please find the sample from the below location and let us know if this helps.

http://files.syncfusion.com/support/PDF.Web/F90330/Sample.zip

If I have misunderstood your requirement, Could you please explain me in detail, so that I can work in depth and try to send a better solution?

Regards,
Thiru


ES Erich Schneider September 28, 2009 06:00 PM UTC

Hi Thiru,

my requirement is to insert a pagebreak, when the value of a column-field changes.
My list includes employees with projects and working hours. When the employee changes I want to set a pagebreak. Is it possible to set a conditional pagebreak.

Thanks


TE Thiruvenkadam E Syncfusion Team September 30, 2009 04:20 AM UTC

Hi Erich,

Sorry for delay in getting back to you on this.

I regret to let you know that "conditional pagebreak" is not possible in our PdfLightTable.

Please let us know if you need any further information.

Regards,
Thiru


ES Erich Schneider October 6, 2009 10:18 PM UTC

Hi Thiru,

I found a solution. I fill a datatable for each employee and after table.draw I add a new page for the next employee.
Now there is a new problem with the header data, where I want to draw the name of the employee. On every page is the name of the last selected employee.

Here the VB code:

If dataTable.Count > 0 Then
page = doc.Pages.Add()

format.Break = PdfLayoutBreakType.FitElement
format.Layout = PdfLayoutType.Paginate
employee = dataTable.Item(0).employee.ToString
ret = runHeader()

table.Draw(page, rect, format)
ret = runFooter()
End If

Protected Function runHeader() As Integer
Dim img As PdfImage = New PdfBitmap(logo)
Dim bezeichnung As String = "Arbeitsrapport " + employee
Dim header As PdfPageTemplateElement = New
PdfPageTemplateElement(0, 0, doc.Pages(0).GetClientSize().Width, 40)

Dim headerStyle As PdfCellStyle = New PdfCellStyle(font_header, PdfBrushes.White, PdfPens.DarkBlue)

'Create cell styles
headerStyle.BackgroundBrush = New PdfSolidBrush(System.Drawing.Color.FromArgb(33, 67, 126))
header.Graphics.DrawString(bezeichnung, headerStyle.Font, headerStyle.BackgroundBrush, 70, 1)
header.Graphics.DrawImage(img, 0, 0, 60, 25)

doc.Template.Top = header
End Function


How can I change the header?

Thanks


TE Thiruvenkadam E Syncfusion Team October 9, 2009 04:01 PM UTC

Hi Erich,

I regret for the long delay in getting back to you on this.

We are currently working on this and we will update you with the status of the same on or before 12th October 2009.

Please let us know if you need any further information.

Regards,
Thiru


TE Thiruvenkadam E Syncfusion Team October 12, 2009 12:01 PM UTC

Hi Erich,

I regret for the long delay in getting back to you on this.

Could you please find the sample from the below location and let me know if this helps.

http://files.syncfusion.com/support/PDF.Web/F90330/Sample90330.zip

Please let us know if you need any further information.

Regards,
Thiru


TE Thiruvenkadam E Syncfusion Team October 12, 2009 12:32 PM UTC

Hi Prema,

I regret for the long delay in getting back with you on this.

If your intention is to close the webpage window after generating the pdf document and we can achieve this by using the window.function funtion in Javascript.
refery reffer the below code snippet.

function closeWindow() {
window.close();
}

Could you please find the sample from the below location and let us know if this helps.

http://files.syncfusion.com/support/pdf.Web/F90473/Sample_Close.zip

If I have misunderstood your requirement, could you please explain me in detail so that I can work in depth and try to send a better solution?

Regards,
Thiru


ES Erich Schneider October 16, 2009 10:15 AM UTC

Now it works as I suposed.
Thank you very much for help.


TE Thiruvenkadam E Syncfusion Team October 19, 2009 12:28 PM UTC

Hi Prema,

Thanks for the update.

We are glad to hear that the reported problem has been solved.

Please feel free to contact us by opening a new forum if you have any other concerns.

Regards,
Thiru

Loader.
Live Chat Icon For mobile
Up arrow icon