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.

Mon Sep 12, 2011 12:26 pm

Hi,

I want to create PDF document but all symbols used in document disappear after saving as PDF.

My code:

var document = new Document();
var section = document.AddSection();

var p = section.AddParagraph();
p.Text = "Symbol should be here:";

var s = p.AppendSymbol(254);
s.FontName = "Wingdings";
document.SaveToFile(@"c:\test.pdf", FileFormat.PDF);
document.SaveToFile(@"c:\test.docx", FileFormat.Docx);
document.Close();


Docx document is saved properly.
But unfortunately PDF document contains only "Symbol should be here:" without symbol i wanted.


I need to generate word and PDF documents with symbols.
What can I do to solve this problem ?

ja312
 
Posts: 2
Joined: Tue Sep 06, 2011 1:43 pm

Tue Sep 13, 2011 12:08 pm

Solution:

var paragraph = section.AddParagraph();
paragraph.Text = "Symbol should be here:";

TextRange r = new TextRange(paragraph.Document);
r.Text = ((char)254).ToString();
r.CharacterFormat.FontName = "Wingdings";

paragraph.Items.Add(r);

Now PDF document contains symbol I wanted.

The key is not to use Spire.Doc.Fields.Symbol class, but I think it's bug in Spire.Doc.

ja312
 
Posts: 2
Joined: Tue Sep 06, 2011 1:43 pm

Wed Sep 14, 2011 6:43 am

Hi,

Thanks for your solution and feedback.
We provided method AppendSymbol to provide to add special symbo of word into doc file. But we implemented the same function in TextRange. So the symbo data is missed during convertion.
We will fix this bug or remove the mthod AppendSymbol in the future version.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Return to Spire.Doc