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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

pdf generation issue( initial part of text is missing when page is breaking to new page)

Thread ID:





97741 Jan 4,2011 11:09 AM UTC Jan 5,2011 01:21 PM UTC ASP.NET Web Forms (Classic) 1
Tags: PDF
Vijay Raja
Asked On January 4, 2011 11:09 AM UTC


we are using the Syncfusion PDF dll (version 4.402.0.51) in our ASP.NET application to generate a PDF document.
we are looping through a datatable to generate the pdf by using graphics.drawmultitext method.
However we are facing issue, whenever the text is breaking to a new page, we are missing initial part of the text in the newpage.
Is it possible to find when the text is going to the new page. Else please provide a way to fix the issue.
Please find the code and sample file attached.,please reply ASAP.

Public Sub Generatepdfdoc(ByVal datatable As DataTable)

Dim LetterHeight, ReferenceHeight, DescriptionHeight As Single
Dim AcronymWidth As Single
Dim x As Single = 5
Dim y As Single = 15
Dim HorizantalWidth As Single = 5
Dim filePath As String

Dim PdfDoc As Syncfusion.Pdf.PDFDocument = New Syncfusion.Pdf.PDFDocument()
PdfDoc.AutoCreatePages = True

Dim font As IPDFFont = PdfDoc.Fonts.Add(New Font("Arial", 8))
Dim GraphicState As IPDFGraphicState = PdfDoc.CreateGraphicState()
GraphicState.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak
Dim page As IPDFPage = PdfDoc.CreatePage()

Dim graphic As IPDFGraphics = PdfDoc.Graphics()
Dim pageWidth As Single = page.DrawingWidth
Dim heightinline As Integer = 0

For i As Integer = 0 To datatable.Rows.Count - 1

LetterHeight = ReferenceHeight = DescriptionHeight = 0
LetterHeight = PdfDoc.Graphics.MeasureString(datatable.Rows(i)("LETTER_REFERENCE").ToString.Trim(), font).Height
ReferenceHeight = PdfDoc.Graphics.MeasureString(datatable.Rows(i)("REFERENCE").ToString.Trim(), font).Height
DescriptionHeight = PdfDoc.Graphics.MeasureString(datatable.Rows(i)("DESCRIPTION").ToString.Trim(), font, pageWidth, GraphicState).Height
AcronymWidth = PdfDoc.Graphics.MeasureString(datatable.Rows(i)("ACRONYM").ToString.Trim(), font).Width

graphic.DrawMultiText(New RectangleF(x, y, pageWidth, LetterHeight), datatable.Rows(i)("LETTER_REFERENCE").ToString.Trim(), font)
y = y + LetterHeight + HorizantalWidth

If Not String.IsNullOrEmpty(datatable.Rows(i)("ACRONYM").ToString) Then
graphic.DrawMultiText(New RectangleF(x, y, pageWidth, ReferenceHeight), datatable.Rows(i)("ACRONYM").ToString.Trim(), font)
x = x + AcronymWidth + HorizantalWidth
End If
heightinline = PdfDoc.Graphics.ClientRectangle.Bottom
graphic.DrawMultiText(New RectangleF(x, y, pageWidth, ReferenceHeight), datatable.Rows(i)("REFERENCE").ToString.Trim(), font)
x = 5
y = y + ReferenceHeight + HorizantalWidth

graphic.DrawMultiText(New RectangleF(x, y, pageWidth, DescriptionHeight), datatable.Rows(i)("DESCRIPTION").ToString.Trim(), font, GraphicState)

y = y + DescriptionHeight + HorizantalWidth + HorizantalWidth


filePath = Server.MapPath("temp/" & "Glossary" & DateTime.Now.ToString("ddMMyyyyhhmmss") & ".pdf")
Context.Response.ContentType = "application/pdf"
Context.Response.Charset = ""
Context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + "Glossary" & DateTime.Now.ToString("ddMMyyyyhhmmss") + ".pdf")
End Sub

Public Sub AddFooter(ByVal pdfdoc As PDFDocument)

Dim font As IPDFFont
Dim footer As PDFTemplateArea = pdfdoc.Templates.Add(New SizeF(pdfdoc.LastPage.DrawingWidth, 40))
font = pdfdoc.Fonts.Add(New Font("Arial", 10, System.Drawing.FontStyle.Regular))
Dim FooterText As String = System.DateTime.Now.ToString("MMMM-yyyy")
Dim pagenumber As String = "Page #p; of #P;"

Dim bounds As RectangleF = New RectangleF(0, 30, footer.Size.Width, footer.Size.Height)
Dim FooterTextGraphicState As IPDFGraphicState = pdfdoc.CreateGraphicState()
FooterTextGraphicState.TextAlignment = TextAlignment.Right
FooterTextGraphicState.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak
footer.Graphics.DrawMultiText(bounds, FooterText, font, FooterTextGraphicState, bounds)
FooterTextGraphicState = pdfdoc.CreateGraphicState()
Dim PageNumberGraphicState As IPDFGraphicState = pdfdoc.CreateGraphicState()
PageNumberGraphicState.TextAlignment = TextAlignment.Center
PageNumberGraphicState.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak
footer.Graphics.DrawMultiText(bounds, pagenumber, font, PageNumberGraphicState, bounds)
PageNumberGraphicState = pdfdoc.CreateGraphicState()
pdfdoc.Templates.Footer = footer

End Sub

Priyadharshini J [Syncfusion]
Replied On January 5, 2011 01:21 PM UTC

Hi Vijay,

Thank you for your interest in syncfusion products.

Currently we do not provide support for version 4.402.0.51, as we have changed our code base completely. The mentioned issue is fixed in our current version. Could you please upgrade to version, you can download the same from the link below.

Sample for the same is placed in the location below:

Kindly try this and let us know if you have any queries.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon