tavinus / pdfScale

Bash Script to Scale and Resize PDFs using Ghostscript
MIT License
246 stars 37 forks source link

Resize in-place #6

Closed BryanEllis closed 6 years ago

BryanEllis commented 6 years ago

I have Letter-sized PDFs with content only for 6x9" per page. This content is at the top left portion with white space to the right and bottom. I am trying to scale the content to fill the page. The pages are meant to print small for a booklet but I need a "large print" version at full letter size. Is this possible? I've tried various options with no luck. I think (not sure) that I need to crop the page to 6x9" then resize to 8.5x11" with a scale of 1.25 to make the contents fill the page.

tavinus commented 6 years ago

Hi! Seems like you basically need to edit your PDFs before anything else.
Without having the actual PDF file it is hard to know for sure, but it seems like it was malformed and the visual data does not sit where it should or is sized the way it should. How was the file created? Maybe the settings were wrong when the file was exported to PDF?

I would probably automate that on Photoshop or Illustrator or something else, unless you are consistently receiving data in that "weird" format.

Anyways, seems like solving https://github.com/tavinus/pdfScale/issues/4 would also present a solution to this problem, since you could then just scale using top-left (instead of center) to fill the paper.

Edit: In this case it may actualy be better to offer a flag that disables the translation call, which is what reposition everything centered. This would probably require a new GS call or at least refactoring the current one.

tavinus commented 6 years ago

Hi again,
I was wondering here.

Can you please post the info about you PDF and then do a little experiment for me?

Get PDF Info:

pdfScale -i PDFFILE.pdf

Then try to run a resize without changing the size, we can use wildcard source for that:

pdfScale -r source -s 1.0 PDFFILE.pdf

You may change 1.0 to something else if you also want to resize/expand.
Say you want it scale +50%:

pdfScale -r source -s 1.5 PDFFILE.pdf

The script runs gs with fit-to-page when in resize mode, which MAY actualy fix your PDF placement problem (unless the white part is considered to be actual content).

You may also want to play with flip-detection and auto-rotation options to fine tune it.
Use pdfScale --help to get more info, examples also on the readme file.

Please let me know how it goes.
Cheers! Gus

tavinus commented 6 years ago

Hi!
I have pushed some changes on a new release - v2.2.0

This one makes possible to reposition the PDF:

Please let me know if that solves your problem.
The release notes and the --help option explain the new functionality.

Edit: v2.2.1 is out!

Cheers!
Gus

BryanEllis commented 6 years ago

The PDFs are generated from a program called Finale which is for musical notation. I am unsure how it is formatted or anything since I am simply the recipient of these files. I will look at your new version. I am not a PDF expert nor a GhostScript expert but have worked with both for a number of years. I think PDFScale is great and really appreciate all the work you've done.

BryanEllis commented 6 years ago

The xtrans/ytrans features are perfect for me!!! It now lets me move the content when resizing and rescaling. In my case I expect to bind the pages on the left so I can make my content off-center with a larger border for the binding. Thank you so much!

tavinus commented 6 years ago

Thanks for the feedback!

I have pushed yet another version (2.3.0).
First one that can auto-update.

Cheers! Gus