How can I get rid of blank pages in aspose.words?

2.4k views Asked by At

I would like to delete blank pages before I save the data to a pdf file. Is there a simple way to do that?

1

There are 1 answers

1
Alexey Noskov On BEST ANSWER

Word documents are not fixed page formats, they are flow, more like HTML. So, there is no easy way to determine where page starts or ends and no easy way to determine whether some particular page is blank. However, there are few options to set n explicit page break in Word document. For example, explicit page break https://apireference.aspose.com/words/java/com.aspose.words/controlchar#PAGE_BREAK

PageBreakBefore paragraph option. https://apireference.aspose.com/words/java/com.aspose.words/ParagraphFormat#PageBreakBefore

section break https://docs.aspose.com/words/java/working-with-sections/

If you delete such explicit page breaks from your document, this might help you to get rid blank pages.