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

Word Document to PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

73215 Apr 24,2008 05:57 PM UTC Oct 10,2008 09:25 AM UTC Windows Forms 3
loading
Tags: PDF
Pedro Carvalho
Asked On April 24, 2008 05:57 PM UTC

Hi. I'm using syncfusion to generate document files, and i need to create a pdf file based this document file.
It this possible??


Bhuvaneswari P [Syncfusion]
Replied On April 25, 2008 07:18 AM UTC

Hi Pedro,

Thanks for evaluating Syncfusion products.

1. Doc to PDF conversion

We don’t have any direct way to convert from Doc to PDF, but you can read the word document into PDF using DocIO library. This can be achieved by enumerate the document elements and write its content into PDF.

Please refer the sample below and let me know if this helps.

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


But you need to manually control the document elements in the PDF document.

Please let me know if you have any other questions.

Best Regards,
Bhuvana



Michael Sing
Replied On October 9, 2008 06:48 AM UTC

To be honest. We are thinking about buying the license but it makes us hold for this now because the generation of pdf from word document and reading from a pdf file are very important to us.

Is your company going to provide the aboves and when?


Sri Subhashini M [Syncfusion]
Replied On October 10, 2008 09:25 AM UTC

Hi Michale,

Thank you for evaluating Syncfusion product.

Here is the answers for your questions,

1.DocToPDF

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

Here is the sample for your reference:
http://websamples.syncfusion.com/samples/PDF.Windows/73215/Pdf_Window_73215.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.

2. Read from PDF Document

If your intention is to read an existing PDF document, it can be achieved by using the PdfLoadedDocument.

'Load a PDF document
PdfLoadedDocument ldoc = new PdfLoadedDocument("Manual.pdf")
ldoc.Save("Sample.pdf");

If I have misunderstood your requirement, could you please explain me in detail, so that I can work in depth and try to send a better solution?

Regards,
Suba


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

;