Hello,
I need to convert a Word document to PDF. First, I need to open the Word document, edit it, and then convert it to PDF.
When I do this, the bold, all caps, and Arial font lose their formatting, and the letter "S" is larger than the rest. The PDF becomes misaligned.
I'm sending the original Word document, the resulting PDF, and the code.
string newName = string.Format(@"{0}_{1}.{2}", "fileResult", new Random().Next(1, 100), FileFormat.Docx.ToString());
string TargetLocalPath = @"D:\temp";
string fullPath = Path.Combine(TargetLocalPath, newName);
byte[] bytes = File.ReadAllBytes(@"D:\Temp\fileSource.docx");
MemoryStream msSource = new MemoryStream(bytes);
MemoryStream msResult = new MemoryStream();
Spire.Doc.Document _documentFile = new Document(msSource);
//Convert to pdf
_documentFile.SaveToStream(msResult, Spire.Doc.FileFormat.PDF);
//Save to Word
_documentFile.SaveToFile(fullPath);
//Save to PDF
newName = newName.Replace(FileFormat.Docx.ToString(), FileFormat.pdf.ToString());
fullPath = Path.Combine(TargetLocalPath, newName);
msResult.Position = 0;
using (FileStream fileResult = new FileStream(fullPath, FileMode.Create, System.IO.FileAccess.Write))
msResult.CopyTo(fileResult);
msResult.Close();
msSource.Close();
_documentFile.Close();
Can you please help me? We just updated our version of Spire.Office, and this didn't happen with the previous version.
[img][/img]
Thank you very much,