Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > PDF

Notices

Reply
 
Thread Tools Search this Thread
Old 05-17-2023, 12:34 AM   #16
willus
Fuzzball, the purple cat
willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.
 
willus's Avatar
 
Posts: 1,274
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
As you figured out, when headers and footers are truly embedded into a PDF procedural stream, most PDF utility apps will not physically remove them as this would require parsing and interpreting the PDF stream and figuring out which part of it displays graphics outside the bounding/clipping box and removing those instructions. This is very difficult to do cleanly and reliably. The real issue is that calibre does not correctly pay attention to the PDF clipping box when converting the PDF to EPUB, as it should.
willus is offline   Reply With Quote
Old 05-17-2023, 06:12 AM   #17
Shohreh
Zealot
Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.
 
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
Indeed, Calibre cropping everything that sits outside the mediabox would have solved the issue easily.
Shohreh is offline   Reply With Quote
Advert
Old 06-23-2023, 10:37 AM   #18
Shohreh
Zealot
Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.
 
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
To remove header + footer on all the pages:

Code:
doc = fitz.open("input.pdf")
#To find mediabox of page 25 in input file: cpdf -page-info input.pdf 25

WIDTH = doc[0].mediabox.width
HEIGHT = doc[0].mediabox.height
rect_header = fitz.Rect(0,0,WIDTH,50) #left,top, right,bottom
rect_footer = fitz.Rect(0,770,WIDTH,790)

numpages = doc.page_count
for index in range(numpages):
	page = doc[index]
	page.add_redact_annot(rect_header)
	page.add_redact_annot(rect_footer)
	page.apply_redactions()
doc.save("redacted.pdf")

#ebook-convert.exe redacted.pdf redacted.epub

Last edited by Shohreh; 06-23-2023 at 04:29 PM.
Shohreh is offline   Reply With Quote
Old 06-23-2023, 01:56 PM   #19
Shohreh
Zealot
Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.Shohreh can program the VCR without an owner's manual.
 
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
On Windows, through its Measurement tool enabled/disabled through the "m" key, the free application SumatraPDF lets you see the mouse coordinates as you move it across the PDF.

To find the left,top and right,bottom coordinates of the section you want to remove, simple move the mouse, and type the coordinates into the script.
Attached Thumbnails
Click image for larger version

Name:	9B7AA0E7-274F-4009-A633-4AB79F9895C8.png
Views:	95
Size:	4.9 KB
ID:	202239  

Last edited by Shohreh; 06-24-2023 at 02:53 AM.
Shohreh is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trimming covers going wrong ownedbycats Calibre 5 07-26-2022 04:03 AM
CBR to PDF Conversion and Trimming stexxe Conversion 3 07-05-2011 01:51 PM
Trimming Covers hmf Library Management 5 03-15-2011 03:44 AM
problems with individuating and trimming the ebooks covers killa Calibre 1 12-11-2010 10:59 AM
TRIMMING MY SHORT 'N CURLIES!!!!! recluse Lounge 19 04-08-2010 12:24 PM


All times are GMT -4. The time now is 05:57 AM.


MobileRead.com is a privately owned, operated and funded community.