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.
Unfortunately, activation email could not send to your email. Please try again.

how to export the DocIo document to pdf

Thread ID:

Created:

Updated:

Platform:

Replies:

67636 Aug 25,2007 05:17 PM Sep 15,2010 10:38 AM ASP.NET Web Forms (Classic) 6
loading
Tags: DocIO
Dimitri ASHIKHMIN
Asked On August 25, 2007 05:17 PM

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

Dimitri ASHIKHMIN
Replied On September 2, 2007 01:48 PM

anyone from support can help me ?

Melba Winshia [Syncfusion]
Replied On September 5, 2007 08:18 AM

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

Mike van Oorschot
Replied On July 25, 2008 03:25 AM

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


Bhuvaneswari P [Syncfusion]
Replied On July 25, 2008 09:12 AM

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




Phuoc Nguyen
Replied On March 31, 2010 03:09 AM

Hi Bhuvana,

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

Thanks,

Phuoc

kim
Replied On September 15, 2010 10:38 AM

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)
{

}

}


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;