Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Improve PDF Output Quality 8 years 6 months ago #9705

  • thessa.alink
  • thessa.alink's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
I would like to ask how to improve the quality of the PDF created using the code below:
---
Document document = new Document();
document.Create("test.pdf");
document.SetCache(Global.tmp_path + "/temp.dat");
.
.
.
currentPage = Bitmap.createBitmap(currentPage, 0, 0, currentPage.getWidth(), pageHeight);

Document.DocImage dimg = document.NewImage(currentPage, true);
currentPage.recycle();
ResImage rimg = page.AddResImage(dimg);

com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(currentPage.getWidth() - (PAGE_MARGIN * 2), pageHeight - (PAGE_MARGIN * 2), PAGE_MARGIN, yOffset);
pageContent.GSSetMatrix(mat);
mat.Destroy();

pageContent.DrawImage(rimg);
pageContent.GSRestore();

// Add Content to Page
page.AddContent(pageContent, true);
pageContent.Destroy();
page.Close();
pageNum++;
}

document.Save();
document.Close();
---
I saved currentPage as PNG and compared it with the output PDF and noticed the degrade in the image quality. I attached test.PNG and test.PDF.
Attachments:

Please Log in or Create an account to join the conversation.

Improve PDF Output Quality 8 years 6 months ago #9706

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
plz compare Bitmap.width and width of PNG file.
seems some pixels lost when load bitmap.

Please Log in or Create an account to join the conversation.

Last edit: by radaee.
  • Page:
  • 1
Powered by Kunena Forum