I am able generate PDF from Word file successfully. Once PDF is generated, I need to insert HD image of dimensions - { Width: 2480px, Height: 3508px, Bit Depth: 24 Image is of A4 page size.} as a background image in generated PDF.
I am able to insert such image using below code.
/* Step 1 - Read Original HD Image and Scale it to have New Bitma as of required size. */
Bitmap newImage = new Bitmap(sourceImg, Convert.ToInt32(this.pageDimensions.PageWidth * pixelsPerInch), Convert.ToInt32(this.pageDimensions.PageHeight * pixelsPerInch));
Here I have constants as -
pixelsPerInch = 96.
this.pageDimensions.PageWidth = 8.27 in.
this.pageDimensions.PageHeight = 11.7 in.
/* Step 2 - Save Newly created Bitmap in Step 1 */
newImage.Save(destFile);
/* Step 3 - Include New Bitmap image in HTML. */
body = “”;
/* Step 4+ => This HTML is then used to generate Word file, which intern generates PDF using Aspose */
But now, problem i face is - Since above code to add image scale the image (to make it fit with PDF Page size) quality is compromised.
So essentially I am looking out for -
- Better way to insert HD image as PDF background.
OR - Retain HD image quality while scaling the image before having it as PDF background.
Thanks.