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

Free Support Forum - aspose.com

Poor PDF output quality when rendering PrintDocument using Aspose.Pdf.PrintController

Hi,
We just renewed & upgraded (to 21.5) our Aspose.Total.Net License because we were looking for a way to render a .Net PrintDocument to a PDF document.
The Aspose.Pdf.PrintController seemed to do the trick with only a few lines of code, but we were rather disappointed by the output.
If we render the PrintDocument to a StandardPrintController(); and print it to an XPS printer or Microsoft PDF printer, the output is clean as expected, and is rendered as text.
We went for the Aspose.Pdf.PrintController in the first place because we want to be able to render documents to PDF without a dependency to a pre-installed printer.
But when we now render the PrintDocument using the Aspose.Pdf.PrintController, the output seems to be rather blurry, and it is rendered as 1 giant image per page instead of text.

Is there any way the print quality can be improved ?
This is the code we used

Stream license = new FileStream(@"E:\TFS_FH\rcx\dev\Source\Framework\PostLibrary\Aspose.Total.NET.lic", FileMode.Open, FileAccess.Read);
            new Aspose.Pdf.License().SetLicense(license);
            streamToPrint = new StreamReader(@"c:\temp\LorumIpsum.txt");
            try
            {
                Aspose.Pdf.PrintController pc = new Aspose.Pdf.PrintController();
                pc.FileName = @"c:\temp\LorumIpsum.pdf";
                               
                PrintDocument pd = new PrintDocument();
                PaperSize a4 = new PaperSize("A4"
                    , (int)Math.Round(21.0f * 72f / 2.54f, 0, MidpointRounding.AwayFromZero)
                    , (int)Math.Round(29.7f * 72f / 2.54f, 0, MidpointRounding.AwayFromZero));          
                pd.PrinterSettings.DefaultPageSettings.PaperSize = a4;
                pd.DefaultPageSettings.Landscape = false;
                pd.DefaultPageSettings.PaperSize = a4;

                pd.PrintController = pc;                

                pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
                
                pd.Print();
            }

            finally

            {
                streamToPrint.Close();
            }

The printPage handler is basically only printing text using MeasureString & DrawString :

s = ev.Graphics.MeasureString(line, font, layoutArea, stringFormat, out fitCharCount, out linesFitted);
PointF location = new PointF(ev.PageSettings.PrintableArea.Left, yPos);
using (SolidBrush drawBrush = new SolidBrush(Color.Black))
    ev.Graphics.DrawString(line, font, drawBrush, new RectangleF(location, s));
yPos = yPos + s.Height;

See attachments for output quality
c03739a6-0b85-4404-831f-1503f8e080d3.pdf (104.5 KB)
LorumIpsum.pdf (2.8 MB)

@mathijssyx

We have already noticed this issue i.e. “pages are converted into images while printing” and have logged it as PDFNET-49756 in our issue tracking system for the sake of correction. Furthermore, you whole case has also been logged under the ticket ID PDFNET-50123. Both tickets have been attached with this forum thread so that you will receive a notification as soon as they are resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi @asad.ali thank you for above message.
Where can we follow the status of issues PDFNET-49756 & PDFNET-50123 ?
If you do also manage your issues in Jira, do we - customers - have access to your Jira backlog to follow-up the progress of the issues ?
Or is the forum the only place where we can see updates ?

Kind regards

@mathijssyx

The tickets have been logged in our internal issue management system and you cannot access it. However, you can follow up on these issues via this forum thread. Also, as soon as the tickets are resolved, we will send a notification in this thread to let you know about the fix-in version.

Hi @asad.ali
Can you give me a high level estimate on the ETA of this fix PDFNET-49756 & PDFNET-50123?
Is it a matter of days / weeks / months ?
This is blocking our own development, and if this takes too much time to fix on your end, we will have to look for an alternative solution.

@mathijssyx

These issues are logged under free support model where issues are resolved on first come first serve basis. Resolution time of the issue depends upon the number of issues and tasks logged prior to it. Furthermore, nature and complexity of the issue also cause more delay in issue fix. The earlier logged issues may take weeks or months in order to get fixed due to mentioned factors. You can escalate the issue priority by reporting it in paid support where issues are fixed on urgent basis.

We will surely inform you as soon as we have some definite updates regarding resolution of the tickets. We highly appreciate your patience in this matter.

We apologize for the inconvenience.