Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Nov 18, 2021 2:32 pm

I am running Spire.Doc 9.11.6 and when I run the following code, the resulting PDF file has missing spaces (see attachments).

Code: Select all
var wordDocument = new Spire.Doc.Document("D:\\InputFile.docx");
wordDocument.SaveToFile("D:\\OutputFile.pdf", FileFormat.PDF);


This is reproducible when the MS Word font is Calibri, but if I change it to Arial the problem seems to go away.

In the Zip File, please find:
InputFile.docx -- The MS Word file
OutputFile.pdf -- The output PDF file
PDF-MissingSpaces.png -- An image showing where in the PDF the spaces are missing

petsupport
 
Posts: 2
Joined: Mon Nov 23, 2020 11:29 pm

Fri Nov 19, 2021 2:48 am

Hello,

Thanks for your inquiry.
I tested your Word file, but did not reproduce your issue. Our Spire.Doc also supports the PS method and the new engine method to convert Word to PDF. The sample code is as follows, please try it. If the issue still exists after trying, please provide your test environment (such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese)) and application type (such as Console app (. Net Framework 4.5)) for further investigation. Thanks in advance.
Code: Select all
Document document = new Document();
 document.LoadFromFile("InputFile.docx");
 //Use the PS method
 ToPdfParameterList toPdf = new ToPdfParameterList();
 toPdf. UsePSCoversion = true;
 document.SaveToFile("OutputFile1.pdf", toPdf);
 //Use the new engine method
 document. UseNewEngine = true;
 document.SaveToFile("OutputFile2.pdf", FileFormat.PDF);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Fri Nov 19, 2021 3:26 pm

Thank you for the response.
I was able to get this to work correctly using the "ToPdfParameterList" approach, which is great.

When I used the "UseNewEngine" approach, the MS Word file did not generate properly at all. All of the Mail Merge fields were blank/empty. You may want to look into this on your side.

Thanks.

petsupport
 
Posts: 2
Joined: Mon Nov 23, 2020 11:29 pm

Mon Nov 22, 2021 2:32 am

Hi,

Thank you for your feedback.
I simulated a Word file with mail merge fields and used the new engine method to convert it to PDF, but did not reproduce your issue. In order to help us investigate your issue quickly and effectively, please provide the following information for our reference. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.
1) Your sample Word file (containing mail merge fields).
2) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
3) Your application type, such as Console app (. Net Framework 4.5).

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc