Is it possible to add a header with table,text and image in a new header on
a existing pdf files using Aspose.pdf?
All existing text and object must be 'moved' down to make Place for the new header.
Thanks in advance.
Is it possible to add a header with table,text and image in a new header on
a existing pdf files using Aspose.pdf?
All existing text and object must be 'moved' down to make Place for the new header.
Thanks in advance.
Hi Hary,
Document doc = new
Document(myDir + “HellWorld.pdf”);<o:p></o:p>
Aspose.Pdf.HeaderFooter headerr = new Aspose.Pdf.HeaderFooter();
Aspose.Pdf.HeaderFooter footer = new Aspose.Pdf.HeaderFooter();
FileStream fs = new FileStream(myDir + "aspose.pdf_logo.png", FileMode.Open, FileAccess.Read);
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
image1.FixWidth = 50;
image1.FixHeight = 50;
//Add the image into paragraphs collection of the section
footer.Paragraphs.Add(image1);
//Set the ImageStream to a MemoryStream object
image1.ImageStream = fs;
Aspose.Pdf.Text.TextState textState = new Aspose.Pdf.Text.TextState();
textState.Font = FontRepository.FindFont("Helvetica");
textState.FontSize = (float)8;
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.ColumnWidths = "200";
table.Rows.Add().Cells.Add("Aspose.pdf for .NET", textState);
table.Rows.Add().Cells.Add("August, 2014", textState);
header.Paragraphs.Add(table);
for (int cnt = 1; cnt <= doc.Pages.Count; cnt++)
{
doc.Pages[cnt].Header = header;
doc.Pages[cnt].Footer = footer;
}
doc.Save(myDir + "Output_DOMheaderfooter.pdf");
Please feel free to contact us for any further assistance.
Best Regards,
Hi Harry,
We apologize for your inconvenience.
OK...Thanks for that.
In the mean time, I have places a small textstamp and imagestamp in the bottom.
Most of the times, there is free space on pdf files i the footer.
And it is running well. Thanks in advance.
Hi Harry,