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,
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.<o:p></o:p>
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 .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 following code snippet. Test it and share the results, hopefully it will help you to improve the print quality.
public void PDFNEWNET_35733()<o:p></o:p>
{<o:p></o:p>
String
inFile = “input.pdf”;<o:p></o:p>
String
outFile = “output.pdf”;<o:p></o:p>
//open document<o:p></o:p>
Document
pdfDocument = new Document(inFile);<o:p></o:p>
var
pdfTextFont = FontRepository.FindFont(“Tahoma”);<o:p></o:p>
var
pdfTextColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);<o:p></o:p>
var
pdfTextBackColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.White);<o:p></o:p>
var
testStamp = new TextStamp(DateTime.Now.ToString())<o:p></o:p>
{<o:p></o:p>
BottomMargin = 10,<o:p></o:p>
LeftMargin = 30,<o:p></o:p>
TopMargin = 10,<o:p></o:p>
// Text is printed as dotted text when we
use Opacity property of TextStamp<o:p></o:p>
Opacity = (float)90 / 100,<o:p></o:p>
HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center,<o:p></o:p>
VerticalAlignment = VerticalAlignment.Top,<o:p></o:p>
};<o:p></o:p>
testStamp.TextState.Font = pdfTextFont;<o:p></o:p>
testStamp.TextState.ForegroundColor = pdfTextColor;<o:p></o:p>
testStamp.TextState.BackgroundColor =
pdfTextBackColor;<o:p></o:p>
pdfDocument.Pages[1].AddStamp(testStamp);<o:p></o:p>
pdfDocument.Save(outFile);<o:p></o:p>
PdfViewer
pdfViewer = new PdfViewer();<o:p></o:p>
pdfViewer.BindPdf(outFile);<o:p></o:p>
// Print system
fonts with native .net method<o:p></o:p>
pdfViewer.RenderingOptions.SystemFontsNativeRendering = true;<o:p></o:p>
// Substitute
embedded fonts with the same named system fonts<o:p></o:p>
FontRepository.Substitutions.Add(new CustomSubst1());<o:p></o:p>
System.Drawing.Printing.PrinterSettings ps = new
System.Drawing.Printing.PrinterSettings();<o:p></o:p>
System.Drawing.Printing.PageSettings pgs = new
System.Drawing.Printing.PageSettings();<o:p></o:p>
System.Drawing.Printing.PrintDocument prtdoc = new
System.Drawing.Printing.PrintDocument();<o:p></o:p>
pgs.Margins = new
System.Drawing.Printing.Margins(0, 0, 0, 0);<o:p></o:p>
ps.PrinterName = “Adobe
Pdf”;<o:p></o:p>
pdfViewer.PrintDocumentWithSettings(pgs,
ps);<o:p></o:p>
pdfViewer.Close();<o:p></o:p>
}<o:p></o:p>
<o:p> </o:p>
private class CustomSubst1
: CustomFontSubstitutionBase<o:p></o:p>
{<o:p></o:p>
public override bool
TrySubstitute(OriginalFontSpecification
originalFontSpecification, out Aspose.Pdf.Text.Font substitutionFont)<o:p></o:p>
{<o:p></o:p>
try<o:p></o:p>
{<o:p></o:p>
// substitute
embedded fonts with system fonts (.Net printing doesn’t support embedded fonts
printing. only system fonts are supported)<o:p></o:p>
if
(originalFontSpecification.IsEmbedded)<o:p></o:p>
{<o:p></o:p>
substitutionFont = FontRepository.FindFont(originalFontSpecification.OriginalFontName);<o:p></o:p>
return true;<o:p></o:p>
}<o:p></o:p>
}<o:p></o:p>
catch
(Aspose.Pdf.Exceptions.FontNotFoundException)<o:p></o:p>
{<o:p></o:p>
// don’t
substitute in case font is not found<o:p></o:p>
}<o:p></o:p>
return base.TrySubstitute(originalFontSpecification, out substitutionFont);<o:p></o:p>
}<o:p></o:p>
}<o:p></o:p>
Please feel free to contact us for any further assistance.
Best Regards,