Mobileread
[PDF] Removing margins?
#1  Shohreh 05-01-2020, 04:29 PM
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.
2A474B12-B1A6-4FD0-BDED-71B6A7ECB761.png 
Reply 

#2  j.p.s 05-01-2020, 04:58 PM
Quote Shohreh
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.
I suspect the crop argument to cpdf would do it.

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.
Reply 

#3  najgori 05-03-2020, 09:54 AM
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.
Reply 

#4  Hitch 05-04-2020, 09:15 AM
Quote j.p.s
I suspect the crop argument to cpdf would do it.

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.
I've used Briss. It's quite manageable and although the documenation is...obscure, it's not hard to figure out. FWIW.

Hitch
Reply 

#5  Shohreh 05-04-2020, 09:42 AM
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
Reply 

#6  j.p.s 05-04-2020, 01:36 PM
Quote Hitch
I've used Briss. It's quite manageable and although the documenation is...obscure, it's not hard to figure out. FWIW.

Hitch
I tried briss about 10 years ago and it was too hard for my pea brain to figure out.

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.
Reply 

#7  j.p.s 05-04-2020, 01:45 PM
Quote Shohreh
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
I think you have a units mixup. 534mm is more than half a meter and 750mm is 3/4th meter.

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
Reply 

#8  Shohreh 05-04-2020, 01:47 PM
Quote j.p.s
I tried briss about 10 years ago and it was too hard for my pea brain to figure out.

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.
Thanks for the tip. I'll add ManDay's croppdf Bash script to the list.

Quote j.p.s
cpdf -crop "100 100 400 600" nput.pdf -o out.pdf5.4/72
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.
3C447E02-B0DA-49DC-AFA7-73595A20C3C9.png 
Reply 

#9  j.p.s 05-04-2020, 02:14 PM
Quote Shohreh
Thanks for the tip. I'll add ManDay's croppdf Bash script to the list.
He made some bug fixes after that. You should get the one he posted in:
https://www.mobileread.com/forums/sh...&postcount=247

Between those posts there are posts regarding usage.
Reply 

#10  Hitch 05-04-2020, 02:16 PM
Quote j.p.s
I tried briss about 10 years ago and it was too hard for my pea brain to figure out.

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.
The thing with Briss is, it's EASIER than you expect. You can GUI it, and you think you have to do this or that, to draw the outlines, but you JUST do it with your damn cursor. I wasted like 2 hours, trying to figure out how to COPY the trim area, and I finally figured out I didn't have to.

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'
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register