Changing font when open as pdf file

Problem 1.
When I have a document created in Word with font Eras Medium ITC, then it will be another font when open it as pdf.
Problem 2.
In Chrome the pdf file will only view a lot of charachters, not any pdf file at all.
I user version 17.6.0.0 version v4.0.30319 on VS2010
You see the code below.

c1 = New SqlClient.SqlCommand(strSQL_PDF, New SqlClient.SqlConnection(Application("strcnn")))
c1.Connection.Open()
d1 = c1.ExecuteReader(CommandBehavior.CloseConnection)
d1.Read()
Dim imageStream As New MemoryStream(CType(d1.GetValue(0), Byte()))
imageStream.Seek(0, IO.SeekOrigin.Begin)
d1.Close()
c1.Connection.Close()
c1 = Nothing
Dim srcDoc As New Aspose.Words.Document(imageStream) 
srcDoc.Save(stream, SaveFormat.Pdf)
Response.AppendHeader("content-disposition", "inline; filename=" + Me.Page.Request.Item("Regnr") & ".pdf")
Dim bytes As Byte() = stream.GetBuffer()
Response.BinaryWrite(bytes)
Response.End()

@Harry_Hajny,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you’re converting documents to PDF. Please refer to the following article:

How Aspose.Words Uses True Type Fonts

If you still face problem, please ZIP and attach your input Word document and fonts that you are your document used here for testing. We will investigate the issue on our side and provide you more information.

Thanks for answer.
Word is installed on the same machine and
the documents have not any problems with fonts i Word, but this is not enough?

@Harry_Hajny,

Thanks for your inquiry. Please note that installing MS Word and fonts are two different things. Aspose.Words requires true type fonts that your document are used for rendering.

Please ZIP and attach your input Word document here for testing. We will then provide you more information about your query.

We will try to install the font and come back with info.

Did you know why pdf format crash when using Chrome?

@Harry_Hajny,

Thanks for your inquiry. Unfortunately, it is difficult to say what is the problem without input and output documents. Please share your documents and screenshots of problematic sections of output. We will test the scenario and provide you more information about your query.

Hi again, We have now installed the font Eras-Medium on the server, but it does not help.
Still another font when it is open in pdf.
font_problem.jpg (76.1 KB)

About the problem (same document and everybody as well).
In IE11 it is open nicely (expet the font) but in Chrome it is not working.

See attachmentsin_ie11.jpg (83.6 KB)
in_chrome.jpg (361.9 KB)

@Harry_Hajny,

Thanks for sharing the screenshots. Please note that Aspose.Words mimics the behavior of MS Word. You can convert your document to PDF using MS Word and check this issue by opening the PDF in Chrome.

To ensure a timely and accurate response please supply us with the following information, if you cannot supply us with this information we will not be able to investigate your issue and raise a ticket.

  • Your input Word document.
  • The Fonts that your document uses.
  • You may embed the fonts in your input document and share it here for testing. To embed a TrueType font in a saved document in Microsoft Office Word 2016, follow these steps:
  1. First, select the File option from the Word ribbon at the top of the screen.
  2. From the options bar on the left-hand side, choose Options.
  3. A Word Options window will come up. Select the Save option from the banner on the left-hand side.
  4. Under Preserve fidelity when sharing this document select the check box next to Embed fonts in the file. Then click OK.

If I embedd the fonts, it works, but that is a lot of work on each document.
Anyway, here is a problem.
The wordfile grows from 48 kB up to 3222 kB??? And of course I am not able to attach it.

@Harry_Hajny,

Thanks for sharing the detail. Please make sure that you have installed all fonts on the machine where you are converting document to PDF and viewing it. Most probably, this issue is related to missing fonts. Please ZIP the fonts and document separately and share it for testing.

Here comes the wordfile and font in a zipfile.
The font is installed on the server as admin where the code is executed.
R-1003.zip (56.4 KB)

About the problem around Chrome, it is problem also with a Word document converted by Word into pdf.
I Think Chrome have a overall issue with streamed files.

@Harry_Hajny,

Thanks for sharing the font and document.

We have converted the document to PDF using latest version of Aspose.Words for .NET 18.2 and have not found the shared issue. Please use Aspose.Words for .NET 18.2. We have also opened the PDF in Chrome and have not found any issue. We have attached the output document with this post along with its screenshot for your kind reference.
output.png (86.7 KB)
18.2.pdf (43.5 KB)

OK, And you used streamed format, not disc files?

Thanks, I will try to update the dll.

I have updated to 18.1 and when I try to open the file in pdf, I got a sign saying the file is
corrupt and cannot be reparied in IE 11.
It work nice in Chrome.
I also have latest Acrobate Reader.

@Harry_Hajny,

Thanks for your inquiry. It seems that this issue is not related to Aspose.Words. The PDF files generated by Aspose.Words can be opened in Adobe reader, Chrome and Internet Explorer. Could you please share the steps that you are using to open the PDF in Chrome and Internet Explorer? We will investigate the issue and provide you more information on this.

Thanks for your fast answer. I have attached the codes for upload wordfiles aThis code for upload and view the word file.zip (16.1 KB)
nd open and view wordfile in pdf format into a frame.

@Harry_Hajny,

Thanks for sharing the detail. In your case, we suggest you please use Document.Save (HttpResponse, String, ContentDisposition, SaveOptions) method to send the document to the client browser. Please use ContentDisposition as Inline in this method.

Document doc = new Document(stream);
doc.Save(Response, "output.pdf", ContentDisposition.Inline, new PdfSaveOptions());

Please refer to the following article. Hope this helps you.
Sending to a Client Browser

Thank a lot, it worked nice, but not on aspose.word version 18, but if I Place the old dll back, it woks fine. At moment this work. I will check the font if it’s better.