We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can write footer to new file but not existing file?

I am trialing Aspose but cannot get it to work properly. The pdf.Save method is not saving the file after adding footer (unless it is a new file):

Dim ms As New MemoryStream(File.ReadAllBytes(“originalfilepath.pdf”))
Dim pdf1 As New Pdf(ms)

Dim sec1 As Section = pdf1.Sections.Add()
Dim hf1 As Aspose.Pdf.Generator.HeaderFooter = New Aspose.Pdf.Generator.HeaderFooter(sec1)
sec1.OddFooter = hf1
sec1.EvenFooter = hf1

’ margins
hf1.Margin.Bottom = 10

’ text
Dim sFontSize As Single = Convert.ToSingle(TaskProcess.Task.PDFAddHeaderFooter.FontSize)
Dim text As New Aspose.Pdf.Generator.Text(hf1, “my footer”))
text.TextInfo.FontSize = sFontSize
text.TextInfo.FontName = TaskProcess.Task.PDFAddHeaderFooter.FontName
Dim fontColor As New Aspose.Pdf.Generator.Color(TaskProcess.Task.PDFAddHeaderFooter.Color)
Dim backgroundColor As New Aspose.Pdf.Generator.Color(TaskProcess.Task.PDFAddHeaderFooter.BackgroundColor)
text.TextInfo.Color = fontColor
text.TextInfo.BackgroundColor = backgroundColor
hf1.Paragraphs.Add(text)

pdf1.Save(strNewPath)

Hi Henrik,


Thank for your inquiry. Please note Aspose.Pdf.Generator is old generator and it can only create new PDF document. It is suggested to use Aspose.Pdf(new generator) , it can create a new PDF document and manipulate existing PDF document as well. Please check following documentation link to add footer in existing PDF document, it will help you to accomplish the task.


Please feel free to contact us for any further assistance.

Best Regards,