Forum


Replies: 1   Views: 1179
How can i delete a last blank page in docx or pdf?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 09-08-2022 - 16:00

Hello,

You can delete pages in PDF files using removePagesPdf (https://www.phpdocx.com/api-documentation/docxutilities/remove-pages-pdf-document-with-PHP).

DOCX documents don't work as PDF documents; in a DOCX document the contents are 'painted' (displayed) dynamically. DOCX documents work with sections that include contents that generate pages (for this reason the exact output of a DOCX depends on the program used to open it).

Using phpdocx you can remove contents in a DOCX using removeWordContent (https://www.phpdocx.com/api-documentation/docx-path/remove-elements-in-docx). With removeWordContent you can remove all contents of the last page knowing which contents you need/want to remove (including the section tag if needed to avoid generating the blank page).

If you send to contact[at]phpdocx.com a DOCX sample we'll generate and send a sample script to illustrate how to remove the contents of its last page using phpdocx (so the last page won't appear).

Regards.