Poor Print quality when printing PDF files

We recently purchased Aspose.PDF.Kit so we could print the PDF files we generate directly from the VB 2008 application ( .NET ) which creates those files.

However, the quality of the printouts are poor. I printed the same PDF files using Adobe Acrobat and even directly from dos, they look great. So, it seems that there is a degradation of the PDF file's resolution when using the Aspose classes.

I looked at the various parameters allowed for PrinterSettings, PageSettings and PrintDocument and see that there are some dealing with resolution, but it's not clear to me how to use them and if they will help.

Here's our code:

Private Function PrintPDF(ByVal sPDFFileNameAndPath As String) As Boolean

Dim viewer As New PdfViewer

viewer.OpenPdfFile(sPDFFileNameAndPath)

viewer.PrintPageDialog = False

Dim ps As New PrinterSettings

Dim pgs As New PageSettings

Dim prtdoc As New PrintDocument

ps.PrinterName = sPrintQueue

Try

viewer.PrintDocumentWithSettings(pgs, ps)

PrintPDF = True

Catch ex As Exception

WriteToLog("Error printing " & ex.Message)

PrintPDF = False

End Try

End Function

Hi Michael,

I would like to share with you that you may use Resolution property of the PdfViewer class to increase the resolution of the output. The default value is 150; however, many of our customers have found value up to 300 quite helpful. Please note that higher the resolution, slower the speed would be.

Moreover, it is important to note that the print quality of the output printed using PdfViewer class is not equal to the output from Adobe Reader etc., as PdfViewer prints the images converted from the PDF pages. Please try to increase the resolution value by setting Resolution property after OpenPdfFile method.

I hope this helps. If you think the output is still not quite up to your expectation then please share the input PDF file with us, so our team would be able to look into it and try to improve the output for your particular scenario.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,

Thank you for the reply. I did tests after setting the resolution property to 300, but it didn't improve the quality. There's still a pixelated look to the document when printed. I even took a stab at setting the property to 600, but same issue.

I'm attaching a sample PDF.

Thanks for looking into this,

Michael

Hi Michael,

I have also noticed the difference in quality at my end. However, as I shared earlier, the quality of the output printed using PdfViewer is not as good as from the Adobe Reader; nevertheless, I have logged this issue as PDFKITNET-26567 in our issue tracking system. Our team will investigate it further and try to improve the quality of the output. You’ll be notified via this forum thread once it is resolved.

We’re sorry for the inconvenience. If you have any further questions, please do let us know.
Regards,

Thank you Shahzad for the quick turn-around to getting this looked at.

I do realize that this is best quality Aspose.PDF.Kit can provide currently. However, this project of ours is the replicate/replace existing applications which are written in legacy/non-compliant programming languages or written with legacy or non-compliant programming tools with .NET applications. The print quality of the legacy versions of this application are noticably higher. And since these printouts are mailed to customers as statements, the visibility of any degradation is quite high.

Our main hurtle to going live with the .NET version of our application is printing PDF files. And this hurtle has caused a quite long delay in this project. So, if a higher resolution cannot be acheived, please let me know as soon as possible so I can seek out other options or not.

Thanks!

Michael

Hi Michael,

First of all, I’m glad to know that you have considered Aspose as your alternative solution at the moment.

Secondly, I have increased the priority of this issue and I’ll be following up with our development team to find out whether we can improve the print quality and in how much time we can improve it. You’ll be updated with the results the earliest possible. Please spare us some time for the investigation.

Lastly, you shared a sample file with us in your previous post; do you think you get mostly the same kind of files or there are some other different kinds of files as well, which you need to print. If so, please share some of the samples, so we could try to investigate the related scenarios as well.

We’re looking forward to help you out.
Regards,

Hi Shahzad,

Thank you for setting a higher priority to this trouble ticket.

Yes, the PDF file I provided is a good general sample.

Let me know what kind of timeframe you'd like - a estimated window - weeks or month for example - so I can inform the interested parties at our company.

Thanks again!

Michael

Hi Michael,

Your concerns have been communicated to our development team. However, I’m afraid, the ETA is currently not available. Our team still needs to investigate this issue in detail. Please spare us some time for investigation and you’ll be updated accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Michael,

We have investigated this issue at our end and I would like to share with you that you need to make a couple of changes in your code to get improved results.

Please have a look at the following code snippet:


Dim viewer As New PdfViewer

viewer.Resolution = 600

viewer.OpenPdfFile(“vTD_11709.pdf”)


viewer.PrintPageDialog = False


Dim ps As New PrinterSettings

Dim prtdoc As New PrintDocument


ps.Copies = 1


Dim pgs As New PageSettings

pgs.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)


viewer.PrintDocumentWithSettings(pgs, ps)


You might notice, in the above code snippet, that the Resolution is being set before OpenPdfFile in order for the resolution to be effective. Also, note that Margins property is also being set to 0 in order to avoid any issue with the display of the output.

Please make these changes at your end and see if it helps. If you still find any issues or have more questions, please do let us know.
Regards,

The change you suggested works really well. The users are happy with that print quality. So thanks!

However, now there's another issue that I had previously resolved - the pdf is printing on the wrong side of the two-sided page.

This statement corrected the issue before the change:

ps.Duplex = Duplex.Vertical

Here's the function:

Private Function PrintPDF(ByVal sPDFFileNameAndPath As String) As Boolean

Dim viewer As New PdfViewer

viewer.Resolution = 600

viewer.OpenPdfFile(sPDFFileNameAndPath)

viewer.PrintPageDialog = False

viewer.Resolution = 600

Dim ps As New PrinterSettings

Dim pgs As New PageSettings

Dim prtdoc As New PrintDocument

ps.Copies = 1

ps.PrinterName = sPrintQueue

ps.Duplex = Duplex.Vertical

pgs.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)

Try

viewer.PrintDocumentWithSettings(pgs, ps)

PrintPDF = True

Catch ex As Exception

WriteToLog("Error printing " & ex.Message)

PrintPDF = False

End Try

End Function

This is an issue because we print on special paper that is folds and is sent out to customers. So, when it prints on the wrong side, the statement info and/or the address info print on the shaded grey area.

Do you have any suggestions for this issue?

Thanks!

Michael

Hi Michael,

I’m glad to know that the print quality issue is resolved at your end. As far as your other issue with printing on the wrong side is concerned, you mentioned that the issue was resolved earlier. Could you please share the thread or issue ID related to that problem, so we could investigate the issue again? If that is not feasible then please share the particular input PDF file with us, so we would be able to look into the issue over here.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Hi,

There isn't another thread for the printing on the wrong side issue. I resolved it by adding the statement:

ps.Duplex = Duplex.Vertical

That resolved the problem with the previous way the function was coded. However, since we moved the statements around, fixing the resolution problem, now the wrong side issue has returned. I tried moving the ps.Duplex = Duplex.Vertical statement but it didn't help.

The PDF I attached previously in this thread is the same one we are working with, so you can use that for testing.

Is this enough to work with?

Thanks

Michael

Hi Michael,

Thank you very much for sharing further details. We’ll investigate this issue at our end and update you with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Michael,

I have been working on this issue, but I couldn’t notice any such anomaly at my end. Could you please share a snapshot or a scanned copy of the current output and the required output? This will help us better understand the issue. However, in the meanwhile, could you please try the following properties as well?


viewer.AutoResize = True

viewer.AutoRotate = True


We're sorry for the inconvenience and looking forward to help you out.
Regards,

Hi.. No problem. I think it would be difficult to replicate w/o using the special forms we have. I was able to fix it by setting the duplex = simplex. Don't ask me why that works!

Thanks,

Michael

Hi Michael,

I’m glad to know that the issue is resolved at your end. If you find any other question or need our assistance, please do let us know.
Regards,