Free Support Forum - aspose.com

Docx to PDF issue

I'm having an issue when exporting to PDF that the PDF is converting everything back to Times New Roman. Also, if saved as a docx the font is Times New Roman. However, the original docx is set to Arial.

I added code like this to reset the font on the run although for large documents this can't seem like the correct way to do it:

For Each r As Aspose.Words.Run In masterDocument.GetChildNodes(NodeType.Run, True)

r.Font.Name = "Arial"

Next

I have the following to return an output stream to me. What am I missing?

Using outStream As New System.IO.MemoryStream

Dim opts As New Saving.PdfSaveOptions

Dim encrypt As New Aspose.Words.Saving.PdfEncryptionDetails("", Guid.NewGuid.ToString, Saving.PdfEncryptionAlgorithm.RC4_40)

encrypt.Permissions = Saving.

PdfPermissions.DisallowAll

encrypt.Permissions = Saving.

PdfPermissions.Printing Or Saving.PdfPermissions.HighResolutionPrinting

opts.EncryptionDetails = encrypt

opts.PrettyFormat =

True

masterDocument.Save(outStream,

SaveFormat.Pdf)

Return outStream.ToArray

End Using

Using outStream As New System.IO.MemoryStream

Dim opts As New Saving.PdfSaveOptions

Dim encrypt As New Aspose.Words.Saving.PdfEncryptionDetails("", Guid.NewGuid.ToString, Saving.PdfEncryptionAlgorithm.RC4_40)

encrypt.Permissions = Saving.

PdfPermissions.DisallowAll

encrypt.Permissions = Saving.

PdfPermissions.Printing Or Saving.PdfPermissions.HighResolutionPrinting

opts.EncryptionDetails = encrypt

opts.PrettyFormat =

True

masterDocument.Save(outStream,

opts)

Return outStream.ToArray

End Using

Hi Russ,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

What environment are you running on?

  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • .NET Framework version
  • Please supply us with the input document that is causing the issue
  • Please supply us with the output document showing the undesired behavior

As soon as you get these pieces of information to us we'll start our investigation into your issue.

Please disregard. I figured out my mistake.

Hi Russ,

Thanks for your feedback. It is nice to hear from you that you have solved your problem. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.