py-pdf / pdfly

CLI tool to extract (meta)data from PDF and manipulate PDF files
BSD 3-Clause "New" or "Revised" License
109 stars 18 forks source link

Add `--format` Option for Custom Page Sizes in `x2pdf` Command #65

Open mulla028 opened 3 weeks ago

mulla028 commented 3 weeks ago

Closes #63

Summary

This pull request introduces the --format option to the x2pdf command in pdfly, allowing users to specify custom page sizes for PDF output. The option supports standard formats such as Letter, A4-portrait, and A4-landscape, as well as custom dimensions (e.g., 210x297 mm). This enhancement provides flexibility for generating PDFs with various page sizes, scaling and centering images to fit each specified format.

Changes

Code Updates

Tests

Verification Steps

  1. Run pdfly x2pdf --help to verify that --format is listed in the options.
  2. Test x2pdf with standard and custom formats:
    
    pdfly x2pdf sample-files/sample1.jpg --output output_letter.pdf --format Letter
    pdfly x2pdf sample-files/sample2.jpg --output output_a4.pdf --format A4-portrait
    pdfly x2pdf sample-files/sample3.jpg --output output_custom.pdf --format 210x297
mulla028 commented 3 weeks ago

Good job tackling this issue! πŸ‘

Thank you for your contribution πŸ™‚

I made a few comments as feedback.

Thank you for your feedback! I will do my best to make all these changes πŸ™‚

mulla028 commented 3 weeks ago

@Lucas-C I tried to make all the requested changes. Review please, and let me know if you noticed any issues!

mulla028 commented 3 weeks ago

@Lucas-C Thank you for your feedback, some things were pretty new to me. Thank you for your patience. Hopefully, this time code follows your requirements πŸ˜„

mulla028 commented 3 weeks ago

@Lucas-C is my problem comes with my code styling?

Lucas-C commented 3 weeks ago

@Lucas-C is my problem comes with my code styling?

No, it's OK πŸ™‚

I only see a couple of blocking points:

You should be able to reproduce the problem by executing the unit tests on your own computer πŸ™‚

Lucas-C commented 5 days ago

Hi @mulla028 πŸ™‚

Just to get a quick update: do you still want to implement this feature?

mulla028 commented 5 days ago

Hi @mulla028 πŸ™‚

Just to get a quick update: do you still want to implement this feature?

Hi! Yes, I just had to do a lot of work for school. I am gonna finish implementing this issue by the end of this week.