Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Jan 04, 2017 9:42 am

When I try to convert a docx to pdf, I meet some issues...

I first do like this with Spire.Doc and it works like a charm :

Code: Select all
Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(path);
string fileName = path.ToLower().Replace(".docx", ".pdf");

document.SaveToFile(fileName, Spire.Doc.FileFormat.PDF);
return fileName;


But when I add the Spire.Pdf licence I encoutered the following exception :

System.TypeLoadException :

Impossible de charger le type 'spr791' à partir de l'assembly 'Spire.Pdf, Version=3.8.121.5040, Culture=neutral, PublicKeyToken=663f351905198cb3'.


First of all why Spire.Pdf is called when I use Spire.Doc ?

So then I try this :

Code: Select all
Spire.Pdf.PdfDocument docx = new Spire.Pdf.PdfDocument();
docx.LoadFromFile(path);
string fileName = path.ToLower().Replace(".docx", ".pdf");

docx.SaveToFile(fileName, Spire.Pdf.FileFormat.PDF);
return fileName;


And here I have :

System.ArgumentException :

Unsupported load file format!


So, how can I convert a docx to a pdf ?

Shadam
 
Posts: 1
Joined: Wed Jan 04, 2017 9:27 am

Thu Jan 05, 2017 1:44 am

Dear Shadam,

Thanks for your inquiry.
Kindly note the feature of converting word to PDF is supported by Spire.Doc Pro Edition, but you purchased Spire.PDF. Please make sure you were using correct version and apply the right license, and then there will be no issue.
Here is the information of the latest Spire.Doc version V5.8.33 for checking.
1)Spire.Doc.dll V5.8.33.3040
2)Spire.Pdf.dll V3.8.112.3040
3)Spire.License.dll V1.3.5.40
In addition, our sales team have sent an email to you, please check. If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF