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

Free Support Forum - aspose.com

PDF.BindXML - Inserted sections appear on new pages

Hi Aspose

I am using PDF.BindXML() to bind xml into the middle of a document I have created using aspose.pdf. This is all working brilliantly, except: The sections that have been added from the BindXML method each appear on a page.

I have tried setting their Section.IsNewPage to false, but this doesn't work.

Has anyone come across this and can you point me in the right direction?



I've discovered that the issue perhaps isn't PDF. The XML is generated by Aspose.Words and saved into xml format with the following code:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);


// Save the doc in an xml Stream that can be handled by Aspose.Pdf.

MemoryStream xmlStream = new MemoryStream();

doc.Save(xmlStream, SaveFormat.AsposePdf);

xmlStream.Seek(0, SeekOrigin.Begin);

planPdf.BindXML(xmlStream, null);

If I obeserve the interim xml I discover the following:

<Section PageWidth="612" PageHeight="792" PageMarginTop="72" PageMarginBottom="72" PageMarginLeft="90" PageMarginRight="90" IsNewPage="true">

Is there anyway to stop aspose.words writing IsNewPage="true" to sections? Or can it be overridden after Binding into the pdf?

Hope this clarifies the issue.



Hi Luke,

I think that can be set in Aspose.Words but I don't know how to set it. I will move your post to Aspose.Words forum. The developers of Aspose.Words will reply to you soon.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Please try using SectionStart.Continuous as shown in the following code snippet:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.CurrentSection.PageSetup.SectionStart = SectionStart.Continuous;


I hope this could help.

Best regards.

Hi Alexey

Thanks for your reply, this helps a little. It changed the IsNewPage attribute in the xml to"false". However, I still have the issue - to explain a bit futher.
The code pasted above is from a method called AddHTMLSection(string html, pdf pdfdoc).
My code is as follows:
pdf planPdf = new pdf();
addSection1(planPdf); //adds a section to the pdf with some text - all using aspose.pdf
AddHTMLSection("html1....", planPdf); //uses the code in my first post
AddHTMLSection("html2....", planPdf); //uses the code in my first post
addSection2(planPdf); //adds another section using aspose.pdf only
addSe..... //and so on, adding many more sections using aspose.pdf
With the addition of the above code, the two html sections now sit together on the same page, however the first HTML section starts on its own page and the second aspose pdf section (addSection2) also starts on its own page!
Any ideas what other properties etc could be causing this? - I've had a play around with Paragraph.IsFirstParagraph and Paragraph.IsFirstParagraphInColumn without much luck.
Many thanks

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

This should be considered as a question regarding Aspose.Pdf. I’ll ask our colleagues to help you.


Hi Luke,

The IsNewPage attribute of Section should be able to resolve your problem. If it can't please provide a sample project that can reproduce the problem.


Thanks for your reply. The IsNewPage attribute definately doesn't fix the problem, however the issue has a low priority for us - we can have the next section on a new page.

Unfortunately it is hard for me to upload code, as I would need to create a new sample project etc etc - and as this isn't a priority I can't spend the time doing that.