We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image Stamp Causing other text to be 'Fuzzy'

Right now I have a process that takes multiple pdfs and merges them together. After merging them together I add text headers and footers (page number) to each page. (page 1 is optional). If I use the following code below to embed a logo then the font that shows up elsewhere on the report looks fuzzy. Not sure how else to describe it beyond fuzzy. If you look at the words 'Property Type' you'll see that they are not the same. I don't know how or why this would occur by just adding an image. I've tried different images, and have changed the Origin around as well to no avail.

Here's the code specific to adding an image.

Aspose.Pdf.Facades.Stamp logoStamp = new Aspose.Pdf.Facades.Stamp();
logoStamp.BindImage(ReportLogPath);
logoStamp.Pages = new int[] { i };
logoStamp.SetOrigin(GetLeftStartingPoint(), ASRFooterMargin);
fileStamp.AddStamp(logoStamp);

Is there something else I need to do?

I'm running Aspose.PDF 6.4.0.0

Here's some more code so you can see how the codes currently set up.

private static FormattedText GetHeaderFooterFormattedText(string label)
{
float textSize = 10.0F;
return new FormattedText(label, System.Drawing.Color.Black, System.Drawing.Color.White, "Verdana", EncodingType.Winansi, true, textSize);
}

public static string AddReportHeadersFooters(string inFile, string outFile, bool includePage1, string ulLabel, string llLabel, string urLabel)
{
bool RunMixedMode = true;

PdfFileInfo fileInfo = new PdfFileInfo(inFile);
int count = fileInfo.NumberOfPages;
PdfFileStamp fileStamp = new PdfFileStamp(inFile, outFile);
FormattedText UpperLeftControlIDText = GetHeaderFooterFormattedText(ulLabel); //"Control ID # 09-0001"
float UpperLeftControlIDWidth = UpperLeftControlIDText.TextWidth;
FormattedText LowerLeftEntityNameText = GetHeaderFooterFormattedText(llLabel); //"Corte Madera Town Center2"
float LowerLeftEntityNameWidth = LowerLeftEntityNameText.TextWidth;

FormattedText UpperRightControlIDText = GetHeaderFooterFormattedText(urLabel); //"Asset Summary Report"
float UpperRightControlIDWidth = UpperRightControlIDText.TextWidth;
FormattedText LowerRightEntityNameText = GetHeaderFooterFormattedText(System.DateTime.Now.ToShortDateString());
float LowerRightEntityNameWidth = LowerRightEntityNameText.TextWidth;

string ReportLogPath = HttpContext.Current.Server.MapPath("/images/reportlogo.png"); //Defaulting the logo here.
for (int i = 1; i <= count; i++)
{
if (includePage1 && i == 1 || i > 1)
{
if (RunMixedMode) //Only add these stamps if you're in mixed mode.
{
//Headers
fileStamp.AddStamp(GetTextStamp(fileInfo, UpperLeftControlIDText, UpperLeftControlIDWidth, i, GetLeftStartingPoint(), 40));
fileStamp.AddStamp(GetTextStamp(fileInfo, LowerLeftEntityNameText, LowerLeftEntityNameWidth, i, GetLeftStartingPoint(), 60));
fileStamp.AddStamp(GetTextStamp(fileInfo, UpperRightControlIDText, UpperRightControlIDWidth, i, GetRightStartingPoint(fileInfo, i, UpperRightControlIDWidth), 40));
fileStamp.AddStamp(GetTextStamp(fileInfo, LowerRightEntityNameText, LowerRightEntityNameWidth, i, GetRightStartingPoint(fileInfo, i, LowerRightEntityNameWidth), 60));

Aspose.Pdf.Facades.Stamp logoStamp = new Aspose.Pdf.Facades.Stamp();
logoStamp.BindImage(ReportLogPath);
logoStamp.Pages = new int[] { i };
logoStamp.SetOrigin(GetLeftStartingPoint(), ASRFooterMargin);
fileStamp.AddStamp(logoStamp);
}

//Footers - //But always add page numbering.
FormattedText PageNumbering = GetHeaderFooterFormattedText(String.Format(@"Page {0} of {1}", i.ToString("N0"), count.ToString("N0")));
fileStamp.AddStamp(GetTextStamp(fileInfo, PageNumbering, PageNumbering.TextWidth, i, GetRightStartingPoint(fileInfo, i, PageNumbering.TextWidth), fileInfo.GetPageHeight(i) - ASRFooterMargin)); //fileInfo.GetPageHeight(i) + 20
}
}
fileStamp.Close();

return outFile;
}

Hi David,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I tested your scenario with the latest version of Aspose.Pdf for .NET v6.6 and I am unable to notice any issue with the generated file. Please download and try the latest version and if you still face any issue, please create a sample application and share it here, we will check it soon.

Thank You & Best Regards,