Documents produce artifacts after printing

I'm having an issue where cell borders do not print properly and display artifacts that don't appear in the Word document. You can see from the PDF sample in the "output" dir that the borders are corrupted below "Sales", "Referrals" and "Departments". Try printing the document out on your printer and you'll see similar artifacts (most noticeably a hanging edge off the left side of the cell border).

I've attached the project.

Thanks,
Natan

Sorry for delay. I had to make intermediary xml and encountered problems. Saving rdReport.doc file in SaveFormat. AsposePdf fails with exception with the latest version of Aspose.Words. I have logged this problem to our defect base as issue #1058. We will try to fix it ASAP.

Also I have not found in your project where the conversion to PDF is done. Please make sure you are using the latest version of Aspose.Pdf during conversion. I cannot recommend the same on Aspose.Words though as we still need to fix this bug.

Impressive project BTW.

Best regards,

Vladimir,

Thanks for the compliment! I actually produced the PDF manually as an example to show you how borders become corrupted when the document is sent to a printing device. Have you printed the document out on an inkjet or laser printer? I think the graphic corruption is independent of the actual printer device.

One of our customers is eager to get this fixed, since they print all their reports. Let me know if there’s a work-around in the meantime.

Thanks,
Natan

Just to be sure - by producing PDF manually you mean printing to Acrobat PDF Writer or Distiller? Or you have used some other way?

I will test the printing issue of course and will notify you as soon as I will find anything.

Best regards,

Yes, I’m using Adobe’s PDF writer.

The problem is not related to Aspose.Words. Artifacts appear due to MS Word ambiguous handling of borders and shading drawn with white color. As a result the documents appear ok on print preview but produce artifacts during printing. To fix the problem you should avoid drawing cell borders with white color.

Here is an example of how you project code could be modified to that purpose:

' Apply top cell borders (if any).

If cssStyleInfo.BorderInfo.IsBordered(Border.Top) And Not cssStyleInfo.BorderInfo.IsOverridden Then

.Borders(BorderType.Top).Color = cssStyleInfo.BorderInfo.cGetColor(Border.Top)

Select Case cssStyleInfo.BorderInfo.sGetStyle(Border.Top)

Case "solid"

.Borders(BorderType.Top).LineStyle = LineStyle.Single

Case "dashed"

.Borders(BorderType.Top).LineStyle = LineStyle.DashSmallGap

End Select

.Borders(BorderType.Top).LineWidth = cssStyleInfo.BorderInfo.nGetWidth(Border.Top)

If .Borders(BorderType.Top).Color = Color.White Then

.Borders.LineStyle = LineStyle.None

End If

End If

The similar code change should be applied for each cell border.

Vladimir,

I’ve added the following line of code to all code blocks that set borders:

’ Apply all cell borders (if any).
If cssStyleInfo.BorderInfo.IsBordered(Border.All) Then
.Borders.Color = cssStyleInfo.BorderInfo.cGetColor(Border.All)
Select Case cssStyleInfo.BorderInfo.sGetStyle(Border.All)
Case “solid”
.Borders.LineStyle = LineStyle.Single
Case “dashed”
.Borders.LineStyle = LineStyle.DashSmallGap
End Select
.Borders.LineWidth = cssStyleInfo.BorderInfo.nGetWidth(Border.All)
If .Borders.Color.Name = “White” Then .Borders.LineStyle = LineStyle.None
End If

I’m still having problems printing, so that probably means I’m missing one step. Did you get this working with my project? If so, can you post the modified project to this thread?

Thanks,
Natan


Thanks! That worked.

Vladimir,

We’re now experiencing a strange behavior where Word will show gridlines around some table cells but not others. Before implementing your fix for the white borders, we never had a report show gridlines. What’s interesting is that if a top border is set to white, then the bottom, left and right borders will show gridlines. If a row/cell has no borders set at all, then no gridlines will appear.

Any thoughts? I’ll attach an example soon.

Thanks,
Natan