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.