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

Free Support Forum - aspose.com

Subsetted TrueType fonts in exported XPS are malformed

Build the Case4603.exe command line app using the supplied C# project sources.

Run the Case4603.exe app and it will read the supplied xlsx file and create the file output.xps

Open the generated output.xps file in VisualStudio and save out the obfuscated odttf file.

Use the supplied DeobfuscateODTTF command line app to create a ttf file.

Use the supplied TTFDump to dump the ttf file to create a text file.

Open the text file in a text editor.

The table at the head of the file looks like this:

 0. 'head' - chksm = 0xF05C337C, off = 0x000000DC, len =       54
 1. 'hhea' - chksm = 0x0DAD037C, off = 0x00000114, len =       36
 2. 'maxp' - chksm = 0x125C2625, off = 0x00000138, len =       32
 3. 'hmtx' - chksm = 0xE69D1658, off = 0x00000158, len =      236
 4. 'fpgm' - chksm = 0xF6F64D0C, off = 0x00000244, len =     2330
 5. 'prep' - chksm = 0x6BAF02FE, off = 0x00000B60, len =     9232
 6. 'cvt ' - chksm = 0xB09BC4D2, off = 0x00002F70, len =     1308
 7. 'loca' - chksm = 0x0007896C, off = 0x0000348C, len =      240
 8. 'glyf' - chksm = 0x79B80997, off = 0x0000357C, len =    16888
 9. 'OS/2' - chksm = 0xF9DDB6D7, off = 0x00007774, len =       96
10. 'name' - chksm = 0x2BB92698, off = 0x000077D4, len =     3411
11. 'cmap' - chksm = 0x0CD60E66, off = 0x00008528, len =      484
12. 'post' - chksm = 0xFF1B0086, off = 0x0000870C, len =       32

According to the TrueType specification, the tags should be ordered numerically ascending, so the correct order should be this:

 9. 'OS/2' - chksm = 0xF9DDB6D7, off = 0x00007774, len =       96
11. 'cmap' - chksm = 0x0CD60E66, off = 0x00008528, len =      484
 6. 'cvt ' - chksm = 0xB09BC4D2, off = 0x00002F70, len =     1308
 4. 'fpgm' - chksm = 0xF6F64D0C, off = 0x00000244, len =     2330
 8. 'glyf' - chksm = 0x79B80997, off = 0x0000357C, len =    16888
 0. 'head' - chksm = 0xF05C337C, off = 0x000000DC, len =       54
 1. 'hhea' - chksm = 0x0DAD037C, off = 0x00000114, len =       36
 3. 'hmtx' - chksm = 0xE69D1658, off = 0x00000158, len =      236
 7. 'loca' - chksm = 0x0007896C, off = 0x0000348C, len =      240
 2. 'maxp' - chksm = 0x125C2625, off = 0x00000138, len =       32
10. 'name' - chksm = 0x2BB92698, off = 0x000077D4, len =     3411
12. 'post' - chksm = 0xFF1B0086, off = 0x0000870C, len =       32
 5. 'prep' - chksm = 0x6BAF02FE, off = 0x00000B60, len =     9232

If you open the xps file using xpsrchvw.exe and print to the CutePDF driver, the text in the generated pdf is garbled. See CuteOutput.pdf. You get similar printout printing to the Ghostscript PDF driver or to Canon or HP drivers.

You can also open the xps file using Reader (part of Windows) and although the printout is better, it still misses part of the first line.

Summary - the obfuscated TrueType fonts in the xps are malformed.

Hi,


Thanks for your posting and using Aspose.Cells.

Please help us look into this issue by providing us your recorded video. You can record your video using VLC player or any other video recording tool. Alternatively, you can provide us the Microsoft Word document with screenshots and descriptions. Thanks for your cooperation in this regard and have a good day.

Hi,


Thanks for using Aspose.Cells.

We were not able to observe the issue and found, for the Microsoft Print to PDF printer issue, everything seems to be OK.

Please download and try the latest version from the following links and give us your feedback.

Aspose.Cells for .NET v17.02.4 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.02.4 (.NET 4.0) compiled in .NET Framework 4.0.

However, we were able to observe the tags issue and logged it as

  • CELLSNET-45187 - Tags should be in ascending ordered as per TrueType specification

Hi Shakeel,

We use aspose.cells to create XPS from Excel documents, and then send the produced XPS to target printers. The printout was garbled, and when I investigated I saw there is a problem with the TrueType fonts embedded in the produced XPS.

The steps I followed were as follows, with more explanatory notes than last time:

  1. You need to be able to build the supplied C# .NET solution. But before you can do this you'll need to edit the csproj file, supplying the path of a valid aspose licence file. Use a text editor to open the file Case4063.csproj and edit the line…

    …ensuring the path points at a valid licence file.
    Then Save the changes and Close the editor.
  2. Ensure your Visual Studio has the OpenXMLEditor.vsix addin installed. You must have this to be able to open XPS files (and docx files - it's a really useful addin)
  3. Inside VisualStudio, Open the supplied solution file Case4063.sln, then build and run it using the [F5] key. The command-line app uses Aspose.Cells to open the supplied 2013-04-19 Support Log.xlsx file and create the file output.xps
  4. Open output.xps using Visual Studio.
  5. Expand the node as shown in the snap744.png
  6. R-click the odttf node and select Open. The tiny chain-link icon for the node indicates it is a linked file - so the Resources node is expanded, showing the actual odttf file. See snap745.png
  7. R-click the odttf file and Export to file. See snap746.png
  8. The file you just created is an odttf file. You'll need to use the supplied command-line tool DeobfuscateODTTF.exe (look in the results folder) to convert the odttf file into a ttf file. The command line is DeobfuscateODTTF.exe infile outfile.
  9. Once you've created the ttf file, you'll need to run the TTFDump.exe program on it to produce a diagnostic report of everything inside the ttf file. Run the program and redirect the output to file.
  10. Open the produced file with a text editor.
  11. There's a list of ttf tags. But the ttf spec says that "Entries in the Table Record must be sorted in ascending order by tag.". The spec is available here. So the tag list is badly ordered.

Here are the steps to produce printed output from the produced xps:

  1. Run xpsrchvw.exe program which is built into Windows, and Open the xps file. Print to Ghostscript PDF or CutePDF printers, and then open the produced PDF in Adobe Reader.I've attached CutePDF.pdf for reference. The pdf looks like snap742.png
  2. If you Print from xpsrchvw to an HP or Canon driver the printed page will look the same as snap742.png
  3. XPS file produced by the Microsoft XPS Document Writer always print correctly from xpsrchvw. The problem is in the XPS created by aspose.cells
I hope you can follow these steps to reproduce the reported behaviour.

I tested using the latest Aspose.Cells,.

On Win8.1 I saw the same problem I originally reported so the new aspose.cells does not fix this.

On Win10 I did not see the problem, but using the earlier aspose.cells version I did not see the error either.

On Win7 I did not see the problem printing the supplied xps file from xpsrchvw.

I've attached output2.pdf which I created on Win8.1.

Would you repeat your test, but this time on Win8.1? I suspect you may have tested on Win10 too.

The app to use is xpsrchvw, which is the file name of the Windows XPS Viewer.

On Win8.1 if you print the supplied xps file from xpsrchvw to CutePDF or Ghostscript PDF (or HP or Canon laser) drivers on Win8.1 then the output is garbled. I don't think there is a Microsoft Print to PDF on Win8.1 - which is what made me think you were testing on Win10.

I think MS may have fixed the XPS-handling code on Win10 to make it more forgiving of malformed XPS.

Microsoft have authored the Font Evaluator - download it from here. When I ran it, it said there was more wrong with the ttf I extracted from the xps than just the tag table being out of order - see the attached file0226.pdf

The odttf font name is supposed to be a GUID - but a name like b76071a0-0000-0000-0000-000000000000 although it's formatted like a GUID, isn't really a guid, is it? And a GUID should change each time the xps is regenerated, shouldn't it? Each time I save an xlsx as xps from aspose.cells the generated odttf files have the same names.

Hi,

Thanks for using Aspose.Cells.

We can reproduce the issue i.e.

  • CELLSNET-45187 - Tags should be in ascending ordered as per TrueType specification

on Win10 with "CutePDF Writer" printer. However, with "Microsoft Print to PDF" printer, it is still OK.

However, even we reordered the tag table, the issue still exists. We cannot figure out what the problem in the font caused the issue.

We used your shared Font Evaluator tool to validate font in XPS file generated by MS Excel(Save as), it also reports some errors and warnings.

For the random GUID problem, we can fix it.

Hi Shakeel

It sounds as though even with correctly-ordered TrueType tags the printout is garbled.

Are you going to raise a second case because the printout is garbled, in addition to the one already raised because the TrueType tags are out of order?

Seems to me there's little point reordering the TrueType tags if it doesn't fix the printout issue.

Hi,


Thanks for your posting and considering Aspose.Cells.

We have logged your comment in our database for product team consideration and investigation. We will look into it and see if this issue could be fixed. Once, there is some news for you, we will let you know asap.

Hi,

Thanks for considering Aspose.Cells

Brian THOMAS:

Hi Shakeel

It sounds as though even with correctly-ordered TrueType tags the printout is garbled.

Are you going to raise a second case because the printout is garbled, in addition to the one already raised because the TrueType tags are out of order?

Seems to me there's little point reordering the TrueType tags if it doesn't fix the printout issue.


We have logged your second issue for investigation. We will look into it and let you know our findings or provide you a fix for it.

  • CELLSNET-45196 - Printout is garbled problem in exported XPS

Thank you Shakeel.

I await further updates.

Hi,

Thanks for using Aspose.Cells.

This is to inform you that we have fixed your issues i.e. CELLSNET-45187 and CELLSNET-45196 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

The issues you have found earlier (filed as CELLSNET-45196;CELLSNET-45187) have been fixed in Aspose.Cells for .NET 17.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

I have now repeated my tests using my test app and aspose.cells 17.3, I saw that:

  • The names of the odttf files within generated xps content are now constructed using a proper guid
  • The ttf data obtained by deobfuscating the odttf files now has an Offset Table that is correctly ordered according to the ttf spec.
  • If I print the produced xps file via xpsrchvw.exe to the CutePDF printer driver, the produced pdf is intelligible.

So I confirm that all the claimed fixes are indeed fixed.

Many thanks!

Hi,

Thanks for your confirmation and using Aspose.Cells.

It is good to know that your issue is resolved with the given fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

What has become of the attachment in my original post?

@Brian_THOMAS

Thanks for your posting and considering Aspose APIs.

We are afraid, your attachments became inaccessible because we could not migrate everything from old forums to new forums smoothly. Such issues are being fixed by Aspose Website Team. So, we are hopeful, it will be fixed if possible. Thanks for your understanding and we are sorry for the inconvenience.