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

Free Support Forum - aspose.com

PDF Text Blurred

Hi,

I am upgrading from Aspose.cells 5.1.4.0 to Aspose.cells 5.3.1.5 and I have an issue with the quality of the PDF generated.

The text is blurred on the PDF generated with aspose.cells 5.3.1.5.

Here is how a created the PDF with aspose.cells 5.3.1.5:
Dim MyPDFSaveOptions As New Aspose.Cells.PdfSaveOptions
If CreateBookmarks = True Then
MyPDFSaveOptions.Bookmark = GeneratePDFBookmarksForWorkbook(pWorkBook)
End If

'convert to stream
Dim retVal As New System.IO.MemoryStream
pWorkBook.Save(retVal, MyPDFSaveOptions)
Return retVal


Here is how a created the PDF with aspose.cells 5.1.4.0:
Public Shared Function WorkbookToPDFFile_Aspose4x(ByVal pWorkBook As Aspose.Cells.Workbook, ByVal pFilename As String, Optional ByVal CreateBookmarks As Boolean = True) As String
Dim retVal As New System.IO.MemoryStream

Dim pSectionNames As IList(Of String) = New List(Of String)
For Each s As Worksheet In pWorkBook.Worksheets
'If s.IsVisible = True Then
pSectionNames.Add(s.Name)
'End If
Next

Dim stream As IO.MemoryStream = New IO.MemoryStream
pWorkBook.Save(stream, FileFormatType.AsposePdf)
'pWorkBook.Save(stream, SaveFormat.Pdf)
stream.Seek(0, IO.SeekOrigin.Begin) '// Reset the pointer to the beginning of the stream

'// Load the document as raw XML
Dim xmlDoc As Xml.XmlDocument = New Xml.XmlDocument
xmlDoc.Load(stream)

stream.Close()
stream.Dispose()
stream = Nothing

'Read the file in Aspose.Pdf.Xml format into Aspose.Pdf
Dim pdf1 As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
pdf1.IsTruetypeFontMapCached = False
'pdf1.IsTruetypeFontMapCached = True
'pdf1.TruetypeFontMapPath = IO.Path.GetDirectoryName(pReportName) 'pourrait ralentir la génération du rapport…
pdf1.IsImagesInXmlDeleteNeeded = True

'Bind the XML file (containing spreadsheet data) with the Pdf object
pdf1.BindXML(xmlDoc, Nothing)

'patch, il semble que les hpagebreak soient considéré comme des sections
'pour éviter de créer des bookmarks, nous allons les trouver
Dim SectionList As New List(Of ePDFSectionType)
For Each SingleWorksheet As Aspose.Cells.Worksheet In pWorkBook.Worksheets
If SingleWorksheet.IsVisible = True Then
SectionList.Add(ePDFSectionType.Worksheet)
For i As Integer = 1 To SingleWorksheet.HorizontalPageBreaks.Count
SectionList.Add(ePDFSectionType.PageBreak)
Next
End If
Next

Dim intSection As Integer = 0
Dim SheetCounter As Integer = 0
For Each sec As Aspose.Pdf.Section In pdf1.Sections
If SectionList.Item(intSection) = ePDFSectionType.Worksheet Then
Dim heading1 As Aspose.Pdf.Heading = New Aspose.Pdf.Heading(pdf1, sec, 1)
Dim segment1 As Aspose.Pdf.Segment = New Aspose.Pdf.Segment(heading1)
heading1.Segments.Add(segment1)
'heading1.IsAutoSequence = True
'If intSection + 1 > pSectionNames.Count Then
If SheetCounter > pSectionNames.Count Then
segment1.Content = “??”
Else
segment1.Content = pSectionNames(SheetCounter)
End If
segment1.TextInfo.FontSize = 0.1 'to make it invisible
sec.Paragraphs.Insert(Nothing, heading1)
SheetCounter += 1
End If
intSection += 1
Next

pdf1.IsBookmarked = True
'pdf1.IsBookmarked = False 'quick fix 2009-11-26
pdf1.BookMarkLevel = 1

'Create the PDF document by calling its Save method
'strReportName = pReportName + “.pdf”
pdf1.Save(pFilename)
pdf1 = Nothing

If IO.File.Exists(pFilename) = False Then
Throw New Exception("Failed to save the document: " & pFilename)
End If

Return pFilename
End Function



What can I do to improve the PDF quality or adjust the anti-aliasing?

Thank you,
Jonathan

Hi,

Please attach the source Excel file (you may save the Excel file using Aspose.Cells API, if you do not use any input file). Also, attach the output PDF files - one created with v5.1.4 and other with 5.3.1.x. We will check your issue soon.

Thank you.

Hi,
I found out that Aspose.cells 5.3.1.5 produces good result as long as there is no chart in the workbook.
MyFund_nochart.xls = PDF convertion is OK
MyFund_withchart.xls = PDF convertion is blurred.

Here is the code used for the conversion:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filename As String
Dim MyWorkbook As Aspose.Cells.Workbook

filename = TextBox1.Text
MyWorkbook = New Aspose.Cells.Workbook(filename)
MyWorkbook.Save(filename.Replace(".xls", "_Aspose_5.3.1.5.pdf"), Aspose.Cells.SaveFormat.Pdf)

filename = TextBox2.Text
MyWorkbook = New Aspose.Cells.Workbook(filename)
MyWorkbook.Save(filename.Replace(".xls", "_Aspose_5.3.1.5.pdf"), Aspose.Cells.SaveFormat.Pdf)

End Sub


Thank you,
Jonathan

Hi Jonathan,


Thanks for your source code and template files. We are able to reproduce said results and we have logged it in our Bug Tracking System as an Enhancement under Ticket ID CELLSNET-25950. Soon we will get back to you on this.

Thank you for using Aspose Products.

Hi Jonathan,


We have tried to open your provided files in serveral PDF Viewers ,only Adobe show text appear blur and when we zoom viewer to larger, text becomes normal.
We have also compared the PDF code. blur text page and not blur page are exactly the same. So we think it is some rendering strategy in Adobe PDF viewer when showing small text.

Moreover, we have recently released the fix version of Aspose.Cells for .Net v5.3.2.4 that you may use to test your scenario and share your feedback with us.

Hi


I just replaced Jonathan on this problem.

Are you sure it is fixed. I am currently trying version 5.3.3 and text is still blurred.

Can you tell me why if I add this line it becomes clear again?


MyPDFSaveOptions.Compliance = Rendering.PdfCompliance.PdfA1b

Do I really need it? Or is it something you forgot when the compliance is set to None?

Hi,


We never provided the fix for the issue associated with this thread. As mentioned in my last reply, we have tested the Aspose.Cells generated PDF files in different viewers and also compared the PDF code for both files [Blur Text PDF / Not-Blur Text PDF]. There was no difference between the two files when opened in any viewer other than Adobe.

I just tried this scenario with latest fix release of Aspose.Cells for .NET 5.3.3.1 [attached] and the result is much better [attached for reference]. Please use below source code with attached version and share your feedback on this.

VB.NET Source Code

Dim MyWorkbook = New Aspose.Cells.Workbook(“C:\temp\MyFund_nochart.xls”)


Dim pdfSaveOp = New Aspose.Cells.PdfSaveOptions()

pdfSaveOp.Compliance = Aspose.Cells.Rendering.PdfCompliance.PdfA1b


MyWorkbook.Save(“C:\temp\MyFund_nochart.pdf”, Aspose.Cells.SaveFormat.Pdf)


MyWorkbook = New Aspose.Cells.Workbook(“C:\temp\MyFund_withchart.xls”)

MyWorkbook.Save(“C:\temp\MyFund_Withchart.pdf”, pdfSaveOp)