0

I created an application which can load a pdf document and then converted it into docx file using aspose.dll library. Lastly, it will display the docx file in WebBrowser control in the windows form application.

This is the code snippet for pdf to word docx conversion.

 Dim filePath As String = txtPath.Text
        ' Dim pdfDocx As Aspose.Pdf.Document = New Aspose.Pdf.Document(filePath)

        'open pdf document
        Dim pdfDocument As Document = New Document(filePath)
        ' instantiate DocSaveOptions object
        Dim saveOptions As DocSaveOptions = New DocSaveOptions()
        ' specify the output format as DOCX
        Try
            saveOptions.Format = DocSaveOptions.DocFormat.DocX
            ' save document in docx format
            pdfDocument.Save("output.docx", saveOptions)
            MsgBox("sUCCESS")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

The saveoptions succeed but now I want to display it in WebBrowser control. How can I do this? Thanks

lara
  • 83
  • 1
  • 13
  • I mean can you _manually_ open a DOCX document in a web browser? If the answer is no, why would you expect this to work programmatically? Check [this answer](https://stackoverflow.com/a/28535008/4934172) and see if it helps you. I didn't try it myself though. – 41686d6564 stands w. Palestine Sep 06 '19 at 01:51
  • Rather than hacking a web browser control to view docs why not try [docx viewer controls for winform](https://www.gnostice.com/nl_article.asp?id=298&t=Free_NET_WinForms_viewer_control_for_displaying_DOCX_DOC_PDF_and_image_formats) – Giddy Naya Sep 06 '19 at 02:01
  • I wanted to view docx file in web browser in window form application @AhmedAbdelhameed – lara Sep 06 '19 at 02:11
  • @lara That's not possible out of the box; you'll have to convert the contents of the Word document into a format that can be displayed in a WebBrowser. Use a DOCX viewer instead as explained in the link in my first comment (I believe it's also the same viewer control suggested by Giddy in his/her comment). – 41686d6564 stands w. Palestine Sep 06 '19 at 02:13
  • This solution is not free for open source projects sir @GiddyNaya – lara Sep 06 '19 at 02:24
  • I cannot use that library as it is not an open source. @AhmedAbdelhameed – lara Sep 06 '19 at 03:26

0 Answers0