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.
Syncfusion Feedback

DocIO to PDF?

Thread ID:

Created:

Updated:

Platform:

Replies:

76457 Sep 8,2008 02:05 PM UTC Sep 9,2008 08:44 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: DocIO
Dima Barashkov
Asked On September 8, 2008 02:05 PM UTC

Can a DocIO document be saved as a PDF? or Syncfusion.PDF import a DocIO and save as a PDF?


Bhuvaneswari P [Syncfusion]
Replied On September 9, 2008 08:44 AM UTC

Hi Dima,

Thank you for your interest in Syncfusion products.

Doc to PDF

We don't have direct option to convert from Doc to PDF. But we have implemented new conversion from doc to HTML in our Volume 3

release (Beta will be available by tomorrow). 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 convert the specific doc to HTML and then convert HTML to PDF.

Code snippet for doc to HTML

'Open the document to convert from word to HTML
Dim doc1 As WordDocument = New WordDocument(textBox1.Text)
Dim htmlExport As HTMLExport = New HTMLExport()
'Export the doc to HTML and save as .html file
strHtml = Application.StartupPath & "doctohtml_res.html"
doc1.SaveOptions.HtmlExportImagesFolder = Application.StartupPath
htmlExport.SaveAsXhtml(doc1, strHtml)

Code snippet for HTML to PDF

Using html As HtmlConverter = New HtmlConverter()
Using img As Image = html.ConvertToImage(strHtml, ImageType.Metafile, CInt(Fix(width)), -1, dimension)
Dim metafile As PdfMetafile = CType(PdfImage.FromImage(img), PdfMetafile)
Dim format As PdfMetafileLayoutFormat = New PdfMetafileLayoutFormat()
format.Break = PdfLayoutBreakType.FitPage
format.Layout = PdfLayoutType.Paginate
pdf.PageSettings.Height = img.Height
format.SplitTextLines = False
metafile.Draw(page, New RectangleF(0, 0, pageSize.Width, -1), format)
End Using
End Using

Here is the sample for your reference:

http://websamples.syncfusion.com/samples/DocIO.Windows/P47690/main.htm


Here is the dll to test this issue:

http://www.syncfusion.com/development/uploads/Doc_Pdf_Dlls_28f2c87e.zip


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 try this and let us know if this helps you.

Best Regards,
Bhuvana



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.

Warning Icon 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.Close Icon

;