Skip to content

Commit 8bb498c

Browse files
marti1125Swati4star
authored andcommitted
#472 - add scaleToFit; fixes margins issue (#476)
1 parent a0c858f commit 8bb498c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/src/main/java/swati4star/createpdf/util/CreatePdf.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ protected String doInBackground(String... params) {
132132

133133
Log.v("Stage 6", "Image path adding");
134134

135+
float pageWidth = document.getPageSize().getWidth() - (mMarginLeft + mMarginRight);
136+
float pageHeight = document.getPageSize().getHeight() - (mMarginBottom + mMarginTop);
137+
image.scaleToFit(pageWidth, pageHeight);
138+
135139
image.setAbsolutePosition(
136140
(documentRect.getWidth() - image.getScaledWidth()) / 2,
137141
(documentRect.getHeight() - image.getScaledHeight()) / 2);

0 commit comments

Comments
 (0)