05-01-2020, 04:29 PM | #1 |
Zealot
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
|
[PDF] Removing margins?
Hello,
I'd like to remove the margins from PDF pages so that each page fills the entire page, before turning them into PNG files, so that pages with complicated layout display fine on e-readers. cpdf looks like it can do this, but I'm lost at which command to use: crop? mediabox? What settings to use? Thank you. |
05-01-2020, 04:58 PM | #2 | |
Grand Sorcerer
Posts: 5,286
Karma: 98804578
Join Date: Apr 2011
Device: pb360
|
Quote:
You might want to explore the sticky threads at the top of the PDF forum https://www.mobileread.com/forums/fo...play.php?f=184 particularly for k2pdfopt and briss. |
|
Advert | |
|
05-03-2020, 09:54 AM | #3 |
Klak
Posts: 174
Karma: 150374
Join Date: Sep 2011
Location: Belgrade, Serbia
Device: many
|
Adobe Acrobat is gold standard for anything pdf.
However it is expensive... Adobe does not sell their programs anymore, I think. You can only rent it. |
05-04-2020, 09:15 AM | #4 | |
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Hitch |
|
05-04-2020, 09:42 AM | #5 |
Zealot
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
|
Thanks. I'll use it if nothing else is available.
I'd rather a single EXE than solutions based on Java or Python. I can't figure out if cpdf can crop/trim margins. This just copies the input file as-is, with no change: Code:
cpdf -page-info input.pdf 72-75 Page 72: Label: 45 MediaBox: 0.000000 0.000000 534.000000 750.000000 CropBox: 43.200000 61.200000 472.800020 706.799990 BleedBox: TrimBox: 42.000000 60.000000 474.000000 708.000000 ArtBox: Rotation: 0 cpdf -crop "0mm 0mm 534mm 750mm" input.pdf -o out.pdf 72-75 Last edited by Shohreh; 05-04-2020 at 09:46 AM. |
Advert | |
|
05-04-2020, 01:36 PM | #6 | |
Grand Sorcerer
Posts: 5,286
Karma: 98804578
Join Date: Apr 2011
Device: pb360
|
Quote:
I don't need to crop a PDF very often, and when I do I almost always end up using the croppdf shell script posted by manday in the Sony DPT-S1 thread after checking whether there is something else easier to use. |
|
05-04-2020, 01:45 PM | #7 | |
Grand Sorcerer
Posts: 5,286
Karma: 98804578
Join Date: Apr 2011
Device: pb360
|
Quote:
The bare numbers are probably points (1/72nd inch). Also 0 0 534 750 is no cropping. Try cpdf -crop "100 100 400 600" nput.pdf -o out.pdf That should be a severe crop. If you really want mm and bare units is actually points, you need to multiply by 25.4/72 |
|
05-04-2020, 01:47 PM | #8 | |
Zealot
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
|
Quote:
Much better. Thanks for the infos about points. I'll experiment and see how to remove the margins on all four sides, and maximize text. Last edited by Shohreh; 05-04-2020 at 01:52 PM. |
|
05-04-2020, 02:14 PM | #9 | |
Grand Sorcerer
Posts: 5,286
Karma: 98804578
Join Date: Apr 2011
Device: pb360
|
Quote:
https://www.mobileread.com/forums/sh...&postcount=247 Between those posts there are posts regarding usage. |
|
05-04-2020, 02:16 PM | #10 | |
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
What is does do that takes some getting used to, is lumping the evens and odds together, on the assumption that you can trim all the pages the same way. That took some getting used to, too, but once I "got it" it took 30 seconds to trim a huge PDF. Easy-peasy; just explained poorly. Hitch' |
|
05-04-2020, 02:31 PM | #11 | |
Zealot
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
|
Quote:
|
|
05-04-2020, 04:50 PM | #12 |
Addict
Posts: 311
Karma: 3196258
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
|
You might have some luck doing it the other way around, ripping all the png files first, then using imagemagick to trim out all the outside whitespace. http://www.imagemagick.org/script/co...tions.php#trim
|
05-05-2020, 01:28 PM | #13 |
Zealot
Posts: 148
Karma: 192898
Join Date: Jan 2016
Device: none
|
As a total newbie, for best quality, I would guess it's better to first crop + rescale in PDF (vector), and then, turn it into an image (raster).
|
05-05-2020, 02:24 PM | #14 |
the rook, bossing Never.
Posts: 11,173
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Lots of PDFs are raster images to start with!
I open in GIMP, which can resize on loading, export with reversed layers as mpg (motion png). Then I edited the local ImageMagick security to allow PDF creation. It can crop, adjust brightness / contrast, mono reduced bit depth etc. So old yellow scans load fast. Beware of L & R margins differing. Obviously a recent technical article originating electronically edit rather than a scan will allow sensible editing and TOC. You need to create an OCR layer to have a TOC on a PDF originating as a scan with no TOC. |
05-05-2020, 03:51 PM | #15 |
Addict
Posts: 311
Karma: 3196258
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
|
Oh, I'd just rip it at whatever your target DPI was anyway for the workflow I described. Which probably doesn't have to be very high if it's ultimately meant for e-reader. Deleting the margins is probably a one-liner batch process with imagemagick/mogrify after that. But I get sticking with tools you're more comfortable with.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Removing the margins on a Kindle Touch? | randomviewer896 | Kindle Developer's Corner | 2 | 06-18-2015 07:26 AM |
PDF Margins on Epub to PDF | viker | Conversion | 3 | 04-02-2012 12:18 AM |
Paragraph breaks when removing margins | Canorka | Conversion | 3 | 03-30-2012 02:00 AM |
Ebook formatting - help with removing margins? | geekgeek | Amazon Kindle | 8 | 12-22-2010 10:27 PM |
Any good app for removing white margins of pdf? | hupple | Amazon Kindle | 4 | 10-17-2010 05:22 PM |