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

Free Support Forum - aspose.com

Need to create a heading in an existing PDF

Hello, I have an existing pdf file, that I need to open, push all existing content down, and in the created space create a heading. This is the code that I use:
var doc = new Document(output);
var pg = doc.Pages[1];
Heading hd1 = new Heading(2);
hd1.Margin.Top = 10;
hd1.Text = “Submittals”;
hd1.TextState.FontSize = 30;
hd1.HorizontalAlignment = HorizontalAlignment.Center;
pg.Paragraphs.Insert(0, hd1);
doc.Save(output);
Unfortunately, it does push the existing content down, but puts the heading text on top of it:
image.png (110.6 KB)
I’ve attached a sample pdf if you need to try it on something. AE-200A_Submittal.pdf.pdf (1013.4 KB)

Please let me know how can I accomplish this.
Thank you

@mpogorelov

Thank you for contacting support.

We are afraid that page contents may not re-position or pushed downwards while making space for new text. Contents will exist on the PDF page as it is. Moreover, Aspose.PDF for .NET API mimics the behavior of Adobe Acrobat. If you are able to relocate the contents while adding text to existing PDF file then please share respective files with us along with the steps so that we may investigate further to help you out.