Images-to-PDF icon indicating copy to clipboard operation
Images-to-PDF copied to clipboard

Feature request 1050. Fit image size

Open valeryvpetrov-dev opened this issue 2 years ago • 3 comments

Description

  • Feature request https://github.com/Swati4star/Images-to-PDF/issues/1050 .
  • Except standard document sizes: A4, A3, etc there is a new option "Fit size". Fit size allows to create pdf document with size of selected image.
  • Caution! com.itextpdf.text.Document class is used while creating pdf file. It does not have API for making document with different page sizes (see Document constructors). So result document cannot be sized like here https://smallpdf.com/jpg-to-pdf (see example screenshot). So I decided to calculate common size for this case. Max width and max height are used to fit selected images so no one will be cropped.

Demo

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

See demo block.

Please describe the tests that you ran to verify your changes.

  • [x] ./gradlew assembleDebug assembleRelease
  • [x] ./gradlew checkstyle

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings

valeryvpetrov-dev avatar Mar 27 '22 12:03 valeryvpetrov-dev

Code Climate has analyzed commit c9090f93 and detected 0 issues on this pull request.

View more on Code Climate.

codeclimate[bot] avatar Mar 27 '22 12:03 codeclimate[bot]

As I mention, com.itextpdf.text.Document does not provide an ability to create document with different page sizes. Document constructor accepts page size as required argument. Document default constructor sets A4 as a default value. Do you have any ideas how to escape this limitation?

valeryvpetrov-dev avatar Mar 29 '22 06:03 valeryvpetrov-dev

Do you have any ideas how to escape this limitation?

Engaged in some work, will look into this soon. ;)

codegsaini avatar Apr 23 '22 07:04 codegsaini

Can you fix the merge conflicts?

Swati4star avatar May 17 '23 15:05 Swati4star

Can you fix the merge conflicts?

@Swati4star done

valeryvpetrov-dev avatar May 19 '23 05:05 valeryvpetrov-dev

Thank you for the contribution! :)

Swati4star avatar May 20 '23 14:05 Swati4star