Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > PDF

Notices

Reply
 
Thread Tools Search this Thread
Old 05-17-2023, 01: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,283
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, 07:12 AM   #17
Shohreh
Groupie
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 181
Karma: 304158
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
Old 06-23-2023, 11:37 AM   #18
Shohreh
Groupie
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 181
Karma: 304158
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 05:29 PM.
Shohreh is offline   Reply With Quote
Old 06-23-2023, 02:56 PM   #19
Shohreh
Groupie
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 181
Karma: 304158
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:	160
Size:	4.9 KB
ID:	202239  

Last edited by Shohreh; 06-24-2023 at 03:53 AM.
Shohreh is offline   Reply With Quote
Old 07-01-2024, 06:08 AM   #20
MarkFalk
Member
MarkFalk began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Mar 2016
Device: kindle touch 5.3.7.3
Try pdfscissors. Here are the related links I have bookmarked:
https://sourceforge.net/p/pdfscissor...read/11d06466/
https://web.archive.org/web/20210213...attredirects=0
https://github.com/abdullah-mazed/pdfscissors
https://www.reddit.com/r/pdf/comment..._pdf_cropping/
MarkFalk is offline   Reply With Quote
Old 07-01-2024, 10:50 AM   #21
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 72,513
Karma: 309063598
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by MarkFalk View Post
Try pdfscissors.
pdfscissors doesn't seem to be in development any more.
pdurrant is offline   Reply With Quote
Old 07-02-2024, 07:20 AM   #22
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 303
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
pdf margins

You can change and EPUB to PDF via calibre and calibre even allows a 'printer offset' (inner margin, either left or right, is wider than outer margin). However, Amazon will not take calibre's output for margins. PDFJAM is the way to go. It does not have a GUI. You can do almost everything imaginable with it, but you have to start with a PDF. Of course most uploads to Amazon are for ebooks, but to submit for printed books to Amazon it is best to upload PDFs. I have in the past asked about altering calibre's method of doing a printer's offset but, apparently, there is something extremely difficult in restructuring its margin capabilities for Amazon's proprietary requirements. Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2024-07-02 05-17-58.png
Views:	68
Size:	460.7 KB
ID:	209327  
rjwse@aol.com is offline   Reply With Quote
Old 07-03-2024, 02:48 PM   #23
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,356
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
I can hard trim and delete pages and change resolution using The GIMP. While not the easiest program to learn it is more obvious than ImageMagick.

Probably loses any invisible OCR layers.
Quoth is offline   Reply With Quote
Old 07-05-2024, 04:11 AM   #24
Shohreh
Groupie
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 181
Karma: 304158
Join Date: Jan 2016
Device: none
The modest Python script I posted served me right several times to remove headers and/or footers before converting a PDF to EPUB without bothering with regexes in Calibre/Sigil.
Shohreh is offline   Reply With Quote
Old 07-05-2024, 09:52 AM   #25
MarkFalk
Member
MarkFalk began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Mar 2016
Device: kindle touch 5.3.7.3
Quote:
Originally Posted by pdurrant View Post
pdfscissors doesn't seem to be in development any more.
Correct. And it is not easy to find; so I have posted all the links I have bookmarked. But it works. Just test it.
MarkFalk is offline   Reply With Quote
Old 07-05-2024, 11:04 AM   #26
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,356
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by rjwse@aol.com View Post
You can change and EPUB to PDF via calibre and calibre even allows a 'printer offset' (inner margin, either left or right, is wider than outer margin). However, Amazon will not take calibre's output for margins. PDFJAM is the way to go. It does not have a GUI. You can do almost everything imaginable with it, but you have to start with a PDF. Of course most uploads to Amazon are for ebooks, but to submit for printed books to Amazon it is best to upload PDFs. I have in the past asked about altering calibre's method of doing a printer's offset but, apparently, there is something extremely difficult in restructuring its margin capabilities for Amazon's proprietary requirements. Best regards, Pop
But if you are publishing you have source. Epub isn't source.

If publishing PDF, then simply edit all the content in LO Writer, with appropriate paragraph, character and page styles, headers, footers, page number etc. Then export a perfect PDF direct from LO Writer.

Epub to PDF is only for own use. Madness for publishing. If I ONLY had epub source, for some reason, I'd export docx or RTF and edit as odt in LO Writer.

Any method of cropping PDFs is also only for own uses, say to read on a larger eInk or tablet.

Calibre is fine for managing ebooks, and conversion of real ebooks (re-flowable).


The common reason for me to crop or adjust background on PDFs is because they are PD scans of old PD books or magasines. k2pdfopt, ImageMagick or the GIMP are the best solutions for that.

The workflow would be a bit different if scanning myself to do OCR or doing OCR of PD scan to create a wordprocessor file, then proofed via epub. I'll rarely do that as I'd only do it to re-publish and I can't imagine taking that effort for likely no return.

My 11" tablet is fine for PDFs, and only a 14″ version of it would be better. I don't need to spend hours making them work on a 6″ to 8 ″ eink or a phone screen.
Quoth is offline   Reply With Quote
Old 07-06-2024, 08:03 AM   #27
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 303
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
Quote:
Then export a perfect PDF direct from LO Writer.
I do not agree at all. LOWriter to PDF does not create precision of placement on the page. Stuff like advanced figures, multiple captions, etc all get garbled. You are talking about simple text and the occasional image here and there. I have tried your method and found it to be lacking quality.
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2024-07-06 05-55-16.png
Views:	58
Size:	397.2 KB
ID:	209397  
rjwse@aol.com is offline   Reply With Quote
Old 07-07-2024, 07:23 AM   #28
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,356
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by rjwse@aol.com View Post
I do not agree at all. LOWriter to PDF does not create precision of placement on the page. Stuff like advanced figures, multiple captions, etc all get garbled. You are talking about simple text and the occasional image here and there. I have tried your method and found it to be lacking quality.
Then you are not creating the document properly. Also my context was exporting an ebook from Calibre when you have no other source.

Or Save As a docx and use which ever PDF creation tool of your choice. Calibre is an ebook management and conversion tool, it's much less suitable to make PDFs.

But converting ebooks or word processor files has nothing to do with "Hard trimming PDFs"
Quoth is offline   Reply With Quote
Old 08-05-2024, 09:00 AM   #29
Jamshid
Junior Member
Jamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplaneJamshid makes transoceanic flights without the assistance of an airplane
 
Posts: 9
Karma: 55638
Join Date: Jul 2024
Device: Sony PRS-T3
Use PDF-Xchange Editor's crop feature and check the option remove content outside the cropped area.
Jamshid is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 03:38 PM.


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