This issue arises because the entire PDF file cannot be disclosed to the client. After I cut off the pdf, however this seems to just hide as the size is still the same and the cutout part can still be called out
First of all, I decided to share the part that can be revealed. Then create a blank page and paste the part that can be disclosed
from PyPDF2 import PdfWriter, PdfReader
reader = PdfReader("text6.pdf")
writer = PdfWriter()
page1 = reader.pages[0]
page1.mediaBox.upper_right = (page1.mediaBox.right/2, page1.mediaBox.top/2 )
page1.cropBox.upper_right = (page1.cropBox.right/2, page1.cropBox.top/2 )
print(page1.mediaBox.getWidth(),page1.mediaBox.getHeight())
Blank_page = PageObject.createBlankPage(None, page1.mediaBox.getWidth(), page1.mediaBox.getHeight())
print(Blank_page.mediaBox.getWidth(),Blank_page.mediaBox.getHeight())
Blank_page.mergePage(page1)
writer.addPage(Blank_page)
with open("PyPDF2-output.pdf", "wb") as fp:
writer.write(fp)