Hi,
apply watermark by Aspose.pdf -> “Test (with watermark).pdf”.
I open this file “Test (with watermark).pdf” in Acrobat Reader and print it in pdf (by PDF Creator) -> “Printed (by Acrobat).pdf”.
If I print to a real printer result is the same.
Hi,
Hi there,
Hi,
Hi there,
Hi,
Hi Igor,
Thanks for your patience.
The development team has been busy resolving other priority issues and I am afraid the issue reported earlier is not yet resolved. Nevertheless, I have requested the team to share the ETA regarding its resolution, As soon as we have some definite updates regarding its resolution, we would be more than happy to update you with the status of correction. Please be patient and spare us little more time.
We are really sorry for this inconvenience.
Hi,
Hi Igor,
Hi Igor,
Thanks for your patience. We have further investigated and found that unfortunately the issue can’t be completely fixed. The issue is a .Net Framework printing known issue - it prints opacity as dot-filled color.
As a workaround, to make the text look better the system fonts may be printed with native .Net Framework text printing method. Embedded fonts may be substituted with the same named system fonts with a custom substitution method.
Please check the following code snippet. Test it and share the results, hopefully it will help you to improve the print quality.
public void PDFNEWNET_35733()
{
String inFile = "input.pdf";
String outFile = "output.pdf";
//open document
Document pdfDocument = new Document(inFile);
var pdfTextFont = FontRepository.FindFont("Tahoma");
var pdfTextColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);
var pdfTextBackColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.White);
var testStamp = new TextStamp(DateTime.Now.ToString())
{
BottomMargin = 10,
LeftMargin = 30,
TopMargin = 10,
// Text is printed as dotted text when we use Opacity property of TextStamp
Opacity = (float)90 / 100,
HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Top
};
testStamp.TextState.Font = pdfTextFont;
testStamp.TextState.ForegroundColor = pdfTextColor;
testStamp.TextState.BackgroundColor = pdfTextBackColor;
pdfDocument.Pages[1].AddStamp(testStamp);
pdfDocument.Save(outFile);
PdfViewer pdfViewer = new PdfViewer();
pdfViewer.BindPdf(outFile);
// Print system fonts with native .net method
pdfViewer.RenderingOptions.SystemFontsNativeRendering = true;
// Substitute embedded fonts with the same named system fonts
FontRepository.Substitutions.Add(new CustomSubst1());
System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();
pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
ps.PrinterName = "Adobe Pdf";
pdfViewer.PrintDocumentWithSettings(pgs, ps);
pdfViewer.Close();
}
private class CustomSubst1 : CustomFontSubstitutionBase
{
public override bool TrySubstitute(OriginalFontSpecification originalFontSpecification, out Aspose.Pdf.Text.Font substitutionFont)
{
try
{
// substitute embedded fonts with system fonts (.Net printing doesn't support embedded fonts printing. only system fonts are supported)
if (originalFontSpecification.IsEmbedded)
{
substitutionFont = FontRepository.FindFont(originalFontSpecification.OriginalFontName);
return true;
}
}
catch (Aspose.Pdf.Exceptions.FontNotFoundException)
{
// don't substitute in case font is not found
}
return base.TrySubstitute(originalFontSpecification, out substitutionFont);
}
}
Please feel free to contact us for any further assistance.
Best Regards,