[Python] [Writer] Remove empty pages?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
yijinger
Posts: 12
Joined: Fri Apr 02, 2021 8:00 am

[Python] [Writer] Remove empty pages?

Post by yijinger »

Hello,

I compiled my document and found some empty pages. How can I look through each page and remove empty ones? I could not find anything useful for my case.
LibreOffice 6.0.7.3 on Linux Mint 20
JeJe
Volunteer
Posts: 2906
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Python][Writer] Remove empty pages?

Post by JeJe »

What do you mean by 'empty page'... a page of blank paragraphs or unwanted manual page breaks?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
yijinger
Posts: 12
Joined: Fri Apr 02, 2021 8:00 am

Re: [Python][Writer] Remove empty pages?

Post by yijinger »

Blank pages appeared due to paragraph breaks - the last element on the previous page inserts "PARAGRAPH_BREAK", and it adds another page, which does not fill. But if I insert a condition concerning this paragraph break, I observe bugs with the previous paragraph.
LibreOffice 6.0.7.3 on Linux Mint 20
Bidouille
Volunteer
Posts: 597
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: [Python][Writer] Remove empty pages?

Post by Bidouille »

In theory, any printer driver is able to ignore blank pages.
yijinger
Posts: 12
Joined: Fri Apr 02, 2021 8:00 am

Re: [Python] [Writer] Remove empty pages?

Post by yijinger »

But my document is not for printing. The problem still not solved.
LibreOffice 6.0.7.3 on Linux Mint 20
User avatar
RoryOF
Moderator
Posts: 34751
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Python] [Writer] Remove empty pages?

Post by RoryOF »

Look at your document in OpenOffice; turn on /View /Non printing Characters, and decide why there are blank pages. It is your document - you can see it, we can't.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
yijinger
Posts: 12
Joined: Fri Apr 02, 2021 8:00 am

Re: [Python] [Writer] Remove empty pages?

Post by yijinger »

Sorry, but I don't see any reason to make this problem personal. I'd like to see a pure solution: you get a document from somewhere and you have to remove blank pages from it. The problem looks simple in this wording, but how simple the solution is?
LibreOffice 6.0.7.3 on Linux Mint 20
User avatar
RoryOF
Moderator
Posts: 34751
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Python] [Writer] Remove empty pages?

Post by RoryOF »

You still see a document that we cannot see. We can only guess what you are seeing and what you have done. You want a solution? Then give us a sample document.

This is like sending one's daughter to doctor to say her father (you) has a pain here(^); Doctor can only guess.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Hagar Delest
Moderator
Posts: 32804
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Python][Writer] Remove empty pages?

Post by Hagar Delest »

I guess that you've to detail a bit this part:
yijinger wrote:Blank pages appeared due to paragraph breaks - the last element on the previous page inserts "PARAGRAPH_BREAK", and it adds another page, which does not fill. But if I insert a condition concerning this paragraph break, I observe bugs with the previous paragraph.
I understand you add a paragraph break to prevent a bug. Fixing that bug in the previous paragraph may eliminate the need of the paragraph break and thus the blank page.
LibreOffice 24.2 on Xubuntu 24.04 and 7.6.4.1 portable on Windows 10
Post Reply