Hi Mike,
To convert a word-document into a pdf
We don't have direct option to convert from Doc to PDF. But we have implemented support for doc to HTML in our latest release Volume 3. Through this we can workaround for Doc to PDF. Already we have support for HTML to PDF. So doc to PDF can be achieved by converting the specific doc to HTML and then convert HTML to PDF.
Code snippet for doc to HTML
[C#]
WordDocument doc1 = new WordDocument(Filename);
HTMLExport htmlExport = new HTMLExport();
//Export the doc to HTML and save as .html file
doc1.SaveOptions.HtmlExportImagesFolder = Application.StartupPath;
htmlExport.SaveAsXhtml(doc1, "sample.html");
Code snippet for HTML to PDF
[C#]
using (Image img = html.ConvertToImage(strHtml, ImageType.Metafile, (int)width, -1, dimension))
{
PdfMetafile metafile = (PdfMetafile)PdfImage.FromImage(img);
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitElement;
format.Layout = PdfLayoutType.Paginate;
pdf.PageSettings.Height = img.Height;
format.SplitTextLines = false;
metafile.Draw(page, new RectangleF(0, 0, pageSize.Width, -1), format);
}
Here is the sample for your reference:
http://websamples.syncfusion.com/samples/DocIO.Windows/DocIO_Doc_PDF/main.htm Please add the below assemblies before run the sample:
1. AxSHDocVw.dll
2. SHDocVw.dll
3. Syncfusion.DocIO.Base.dll
4. Syncfusion.Core.dll
5. Syncfusion.Compression.Base.dll
6. syncfusion.htmlconverter.base.dll
7. syncfusion.pdf.base.dll
Note: we do have only limited support for doc to HTML. Not all the elements are converted to HTML page.
Please download the latest version from the below link:
http://www.syncfusion.com/downloads/latestversion/default.aspx Please let me know if you have any questions.
Best Regards,
Bhuvana