We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

how to export the DocIo document to pdf

I am evaluating the backoffice suite and i succeed to create the word document

Still i can not find how to convert it to pdf. I searched FAQ and forums, found several topics mentioning it but never found a code sample

Could you post me one, please ?

Dimitri

6 Replies

DA Dimitri ASHIKHMIN September 2, 2007 05:48 PM UTC

anyone from support can help me ?


MW Melba Winshia Syncfusion Team September 5, 2007 12:18 PM UTC

Hi Dimitri,

Thank you for your interest in Syncfusion products.

Currently we do not provide support for Doc to PDF. Sorry for the inconvenience caused.

Please let me know if you have any other questions.

Thanks,
Melba


MV Mike van Oorschot July 25, 2008 07:25 AM UTC

Hi,

I understand Doc to PDF was possible in older versions of the DocIO and PDF libraries but was not supported. Since the recent re-working of the PDF library there doesn't seem to be any way to do this.

Please can you confirm if Doc to PDF is possible at all. If not, are there any plans to support this conversion and if so, when?

Thanks in advance,

Mike.



>Hi Dimitri,

Thank you for your interest in Syncfusion products.

Currently we do not provide support for Doc to PDF. Sorry for the inconvenience caused.

Please let me know if you have any other questions.

Thanks,
Melba



BP Bhuvaneswari P Syncfusion Team July 25, 2008 01:12 PM UTC

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





PN Phuoc Nguyen March 31, 2010 07:09 AM UTC

Hi Bhuvana,

Word to Pdf conversion available to SilverLight? If so what library do I need to reference?

Thanks,

Phuoc


KI kim September 15, 2010 02:38 PM UTC

Hi!

Try the code below. It works foe me.

Hope it helps!

using Syncfusion.DocToPDFConverter;


private void DocToPDF()
{
string path = @"C:\DocFile.doc";
string outPdfPath = @"C:\out.pdf";
WordDocument document = new WordDocument();
try
{
document.Open(path, FormatType.Doc);

DocToPDFConverter converter = new DocToPDFConverter();
PdfDocument pdfDoc = converter.ConvertToPDF(document);
pdfDoc.Save(outPdfPath);
pdfDoc.Close(true);
System.Diagnostics.Process.Start(outPdfPath);

}
catch (Exception ex)
{

}

}


Loader.
Live Chat Icon For mobile
Up arrow icon