Hi pawanjois,
No its not possible without using Office Interop or any third party library.
Using Office Interop refer the below sample code.
C#
private void Word2PDFWithInterop(object source, object destination)
{
object missing = Type.Missing;
Microsoft.Office.Interop.Word.Application application = new Microsoft.Office.Interop.Word.Application();
try
{
application.Visible = true;
application.Activate();
// Open the source document
application.Documents.Open(ref source, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
application.Application.Visible = false;
application.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize;
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;
// Export it in the specified format
application.ActiveDocument.SaveAs(ref destination, ref format, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
}
catch (Exception e)
{
// Respond to the error
Response.Write(e.Message);
}
finally
{
// Close and release the Document object
if (application != null)
{
application.Documents.Close(ref missing, ref missing, ref missing);
}
application.Quit(ref missing, ref missing, ref missing);
}
}
VB.Net
Private Sub Word2PDFWithInterop(source As Object, destination As Object)
Dim missing As Object = Type.Missing
Dim application As New Microsoft.Office.Interop.Word.ApplicationClass()
Try
application.Visible = True
application.Activate()
' Open the source document
application.Documents.Open(source, missing, missing, missing, missing, missing, missing, missing, _
missing, missing, missing, missing, missing, missing, missing, missing)
application.Application.Visible = False
application.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize
Dim format As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF
' Export it in the specified format
application.ActiveDocument.SaveAs(destination, format, missing, missing, missing, missing, missing, missing, _
missing, missing, missing, missing, missing, missing, missing, missing)
Catch e As Exception
' Respond to the error
Response.Write(e.Message)
Finally
' Close and release the Document object
If application IsNot Nothing Then
application.Documents.Close(missing, missing, missing)
End If
application.Quit(missing, missing, missing)
End Try
End Sub