title: PDF size too large generating through Android PDFDocument. And while using pdfbox it is cutting image in output
body: <p>I am using android pdf document library to convert image into pdf but it is generating very large size pdf.</p>
  
  <pre><code>PdfDocument document = new PdfDocument();
  PdfDocument.PageInfo pageInfo =new 
  PdfDocument.PageInfo.Builder(bitmap.getWidth(), bitmap.getHeight(), 1).create();                            
  PdfDocument.Page  page = document.startPage(pageInfo);
  Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth(), 
  bitmap.getHeight(),false);                        
  
  Canvas canvas = page.getCanvas();
  canvas.drawBitmap(scaledBitmap, 0f, 0f, null);
  document.finishPage(page);
  
  document.writeTo(new FileOutputStream(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+"/"+newPDFNameSingle));
  document.close();
  </code></pre>
  
  <p>here is the apache pdf box implementation but it is cutting image in output pdf</p>
  
  <pre><code>PDDocument document = new PDDocument();
  PDPage page = new PDPage();
  document.addPage(page);
  
  PDPageContentStream contentStream = new PDPageContentStream(document, page);
  InputStream inputStream = new FileInputStream(tempFile);
  PDImageXObject ximage = JPEGFactory.createFromStream(document,inputStream);
  
  contentStream.drawImage(ximage, 20, 20);
  contentStream.close();
  
  document.save(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+"/"+newPDFNameSingle);
                              document.close();
  </code></pre>
  
  <p>How can I achieve regular size pdf generation? My image in 100 kb in size but pdf generating 1 mb file.</p>