Error when converting from PDF to DOCX on .NET Core 3.1 Windows (Process terminated. Assertion failed. Cannot read a name from the name table in a font.)

Version: 20.4.0
Sample code/repo: https://github.com/sep/aspose-pdf-error

When calling Aspose.Pdf.Document.Convert on Windows .NET Core, I consistently get the below error.

// example code
Document.Convert(srcFileName, null, dstFileName, new DocSaveOptions
            {
                Format = DocSaveOptions.DocFormat.DocX,
            });

error text:

$ ./PdfToWordExample.exe hello_msword.pdf
Process terminated. Assertion failed.
Cannot read a name from the name table in a font.
at #=zSxSO3z15QdTvI7rksayb5HeFV7qkTPi4hQ==.#=zt4xUns85Vujn(Int32 #=zF6312Fk=)
at #=zSxSO3z15QdTvI7rksayb5HeFV7qkTPi4hQ==.#=z3hqh7z0=()
at #=zSxSO3z15QdTvI7rksayb5HeFV7qkTPi4hQ==.#=zZUf3c_hhZaaI(#=zxSvHuPbwIiLenohdWF19MC8= #=zbtB7$zs=)
at #=zm5PqrMJE6FWsDpIkG06GeRRm_fkO.#=zZUf3c_hhZaaI(#=zxSvHuPbwIiLenohdWF19MC8= #=zbtB7$zs=)
at #=z3yaue1vDPNdLQ8$u5VX6BrNbk$qu.#=z95mPjywolgrb(#=zxSvHuPbwIiLenohdWF19MC8= #=zbtB7$zs=)
at #=zm5PqrMJE6FWsDpIkG06GeRRm_fkO.#=z96RAgrD6$WkuUgA$Qw==(#=zxSvHuPbwIiLenohdWF19MC8=[] #=zKPK3Dd7Jqmnk)
at #=z3yaue1vDPNdLQ8$u5VX6BrNbk$qu..ctor(#=zxSvHuPbwIiLenohdWF19MC8=[] #=zKPK3Dd7Jqmnk)
at #=ze5mHjDNSsWQN1eYjtTp34kNS5flE.#=z_oKJW4UaKypt(#=zxSvHuPbwIiLenohdWF19MC8=[] #=zh54bDjxFSOil)
at #=ze5mHjDNSsWQN1eYjtTp34kNS5flE.#=z_oKJW4UaKypt()
at #=ze5mHjDNSsWQN1eYjtTp34kNS5flE.#=zq8lFwRZcO96M()
at #=ze5mHjDNSsWQN1eYjtTp34kNS5flE.#=zisoFYy0=(String #=zxEui2c0=, FontStyle #=zvVKMXOI=)
at #=zAgvPyreAEdEKHaSLxi8iFkq4J6sV.#=z0qz$9lbKhsN_(String #=zxEui2c0=, FontStyle #=zvVKMXOI=, String #=zHUJ5kLQqrXGF)
at #=zAgvPyreAEdEKHaSLxi8iFkq4J6sV.#=ztV3lPeGcFu0G(String #=zxEui2c0=, Single #=zJWh00is_e6JL, FontStyle #=zvVKMXOI=, String #=zHUJ5kLQqrXGF)
at #=zAgvPyreAEdEKHaSLxi8iFkq4J6sV.#=ztV3lPeGcFu0G(String #=zxEui2c0=, Single #=zJWh00is_e6JL, FontStyle #=zvVKMXOI=)
at #=zLme2SQ0wNCE8dE$IpchMzOcH0Hst..cctor()
at #=zLme2SQ0wNCE8dE$IpchMzOcH0Hst.#=z7WKo1Do=()
at #=z8SnrKyfzlOeGAcNuugGlVD9VbOXo2szcym_gS5g=..ctor(#=zvIi1ia7bgTa3mu1nshbq2G9dSY0kzm09IfdyKsg= #=zuePxi$M=)
at #=z6RalRduJVQKd5EZuNVMJuKliYjK8PHg7Gw==..ctor(#=zYCtESQ5lSIQrdfrShoiDgJfmWB$DG3PFOzp4KyM=#=zuePxi$M=, Stream #=z6nozkAeK$NlS)
at #=zF_6hL3aP8NZVRW0KIO57xhg=.#=zvNzwBxfHvo1e(Document #=zcFgz3wE=, DocSaveOptions #=zuePxi$M=, Stream #=zykDMhKF5zYK4)
at #=zF_6hL3aP8NZVRW0KIO57xhg=.#=zzhUKHADMKKfcAC4tBg==(Document #=zcFgz3wE=, DocSaveOptions #=zuePxi$M=, Queue`1 #=zfWhL2gZKyBnn, Stream #=zykDMhKF5zYK4, Int32 #=z7vqWldne7BE7)
at #=zF_6hL3aP8NZVRW0KIO57xhg=.#=zRJreogk=(Document #=zcFgz3wE=, Stream #=zykDMhKF5zYK4, DocSaveOptions #=zuePxi$M=)
at Aspose.Pdf.Document.#=zYI$W0LMGXYgC(Stream #=zykDMhKF5zYK4, SaveOptions #=zuePxi$M=)
at Aspose.Pdf.Document.#=zYI$W0LMGXYgC(String #=zKB2HGNZAmo5E, SaveOptions #=zuePxi$M=)
at Aspose.Pdf.Document.Save(String outputFileName, SaveOptions options)
at Aspose.Pdf.Document.Convert(String srcFileName, LoadOptions loadOptions, String dstFileName, SaveOptions saveOptions)
at PdfToWordExample.Program.Main(String[] args) in C:\Users\jcfuller\dev\PdfToWordExample\PdfToWordExample\Program.cs:line 30

Am I doing something wrong? or is this an issue/bug?

Thanks in advance! Please let me know if there is anything else I can do to help shed light on the problem.

@jonfuller

Thanks for contacting support.

Can you please share source file so that we may further investigate this issue in details to help you out.

Thanks for responding.

Here is the source in a public github repo:

Line 33 of Program.cs

Also replicated here:

                Document.Convert(srcFileName, null, dstFileName, new DocSaveOptions
                {
                    Format = DocSaveOptions.DocFormat.DocX,
                });

@jonfuller,

I have observed your comments. Can you please share source PDF file which you want to convert to Word file using sample code of github repo so that I may investigate this issue on our end to help you out.

Yep.

I included several in the public github repo as well.

Here are direct links to them:

@jonfuller,

I like to inform that I have worked with sample code and source file shared by you using Aspose.PDF 20.4 on .NET core and unable to observe any exception. Can you please share your complete environment details along with .NET core version so that we may further investigate to help you out.hello_msword.pdf (178.6 KB)
hello_msword12.zip (5.9 KB)

Weird!

I added a little bit of code to my sample application to show the Windows and Runtime versions.

Here’s what the output looks like to me:

Operating System: Microsoft Windows NT 6.2.9200.0 - (core info: Microsoft Windows 10.0.18363)
Runtime: 3.1.3 - (core info: .NET Core 3.1.3)

Can you do the same? I’m curious what may be different between our systems?

Here’s a link to how I printed those values:

Thanks again!

@jonfuller,

Thanks for contacting support.

We were able to notice the issue that you have mentioned and logged it as PDFNET-48011 in our issue tracking system. We will definitely look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

No problem!

Thanks for the update! Looking forward to a resolution!

@jonfuller,

Sure we will share update with you. Your welcome.

Hi @Adnan.Ahmad

We noticed exact the same scenario when trying to convert PDF file to PPTX using Aspose.Slides library.
We using licenced version for PDF it is 19.10.0 and for Slides 19.9.0. We also tested scenario with newest version of libraries downloaded from the site and used as trial version. In both scenarios we have same error :

Process terminated. Assertion failed.
Cannot read a name from the name table in a font.

We also using .net core 3.1 version and our scenario fails only on linux . On windows everything is working. We tested 3 distributions of linux: Ubuntu 19.10, Debian and Linux Mint 10.3. In all cases scenario is exact the same.

Weird in this case is that we also try to test this for blank pdf without any fonts or other objects only one empty page. Same error occurs so I don’t know why error message is connected with font ?

We tested this also by downgrading our application to .net core 2.2 but same problem exists.

If my small test application will be helpful for you please let me know

Thank you in advance for any information

@leszex,

Can you please share source code along with source files to further investigate this issue. Also please share which product you are using on your end to convert PDF file into PPTX.

@Adnan.Ahmad

Here is test application that use Aspose.Slides to save pdf to pptx file. On windows all works perfect on linux machine error is thrown.

PPTXAspose2.2.zip (30.1 KB)

@leszex,

I like to inform that issue which you are facing is because of unavailability of fonts on linux environment. Can you please check and make sure required fonts are available on linux environment. If fonts are not available you can load them using method available in this thread.

.

@Adnan.Ahmad

We tried this solution earlier. Please look at source code I sent to you. We have this line :

Aspose.Pdf.Text.FontRepository.Sources.Add(new Aspose.Pdf.Text.FolderFontSource("/usr/share/fonts/Windows"));

There is no method in .Net version

FontRepository.addLocalFontPath("path_to_fonts");

We have also package msttcorefonts installed on Linux. We also copy all windows fonts to directory: /usr/share/fonts/Windows. on linux machine

We still getting same error. Please try to compile our sources and run it on some linux machine.

@leszex,

Did you checked that fonts which are being used are available in fonts folder.

@Adnan.Ahmad

Yes like I said we tested it with simple Arial text in pdf and we ensured that Arial font is in directory

"/usr/share/fonts/Windows"

We also made tests with empty pdf (without any text, just empty page) and we still getting same error. Blank pdf file was also placed in source code that is attached.

If there is no fonts in pdf file so why error message is talking about font name ?

@leszex,

We have logged an investigation ticket as PDFNET-48098 and I have mentioned all the details in in our issue tracking system. We will further investigate the scenario in details and keep you posted with the status of ticket resolution. Please spare us little time.

We are sorry for the inconvenience.

@Adnan.Ahmad,

Hi Adnan, my team is planning for its next release. Issue PDFNET-48011 is currently blocking that release.

I’m curious if you are able to offer a timeline on that issue? That would help us decide whether we should start a workaround, or if we should wait on an upcoming release of Aspose.PDF that might have the issue fixed.

Thanks in advance!
-Jon

@jonfuller,

I like to inform this issue has been added recently in our issue tracking system and as per our company policy, the first priority for investigation is given to the Paid Support i.e. Enterprise and Priority Support on first come first serve basis. After that the issues from normal support forum are scheduled for investigation on first come first serve basis. I request for your patience and we will share good news with you soon.