Skip to content

Commit

Permalink
Merge pull request #55 from kmark1625/master
Browse files Browse the repository at this point in the history
Improve PDF conversion performance
  • Loading branch information
Swati4star authored Apr 27, 2018
2 parents 617b375 + 7315e2b commit cc71561
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Hurray! PDF files of selected images are created.
+ [Morphing Button](https://github.com/dmytrodanylyk/android-morphing-button)
+ [TedPicker](https://github.com/ParkSangGwon/TedPicker)
+ [Material Dialogs](https://github.com/afollestad/material-dialogs)
+ [Compressor](https://github.com/zetbaitsu/Compressor)

#### Code & Issues
If you are a developer and you wish to contribute to the app please fork the project
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ dependencies {
transitive = true
}
compile 'com.jakewharton:butterknife:8.4.0'
compile 'id.zelory:compressor:2.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.ColorRes;
import android.support.annotation.DimenRes;
import android.support.annotation.IntegerRes;
Expand All @@ -36,12 +35,12 @@
import com.itextpdf.text.pdf.PdfWriter;
import com.theartofdev.edmodo.cropper.CropImage;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;

import butterknife.ButterKnife;
import id.zelory.compressor.Compressor;
import swati4star.createpdf.R;
import swati4star.createpdf.adapter.ViewFilesAdapter;

Expand Down Expand Up @@ -404,11 +403,10 @@ protected String doInBackground(String... params) {

for (int i = 0; i < imagesUri.size(); i++) {

Bitmap bmp = MediaStore.Images.Media.getBitmap(
activity.getContentResolver(), Uri.fromFile(new File(imagesUri.get(i))));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 70, stream);

Bitmap bmp = new Compressor(getContext())
.setQuality(70)
.setCompressFormat(Bitmap.CompressFormat.PNG)
.compressToBitmap(new File(imagesUri.get(i)));

image = Image.getInstance(imagesUri.get(i));

Expand Down

0 comments on commit cc71561

Please sign in to comment.