We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to convert doc to pdf

Hi,

I am using 8.2.0.0 for doc to pdf...bt unable to do it..

Public Shared Function ConvertDocToPDF(ByVal doc As Aspose.Words.Document) As Aspose.Pdf.Generator.Pdf

Dim stream As IO.MemoryStream = New IO.MemoryStream

' doc.SaveOptions.PdfExportImagesFolder = System.IO.Path.GetTempPath()

doc.Save(stream, Aspose.Words.SaveFormat.Pdf)

stream.Flush()

stream.Seek(0, IO.SeekOrigin.Begin)

Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument

'xmlDoc.PreserveWhitespace = False

'Dim reader As New System.Xml.XmlTextReader(stream)

'Dim writer As New System.Xml.XmlTextWriter(stream, Encoding.UTF8)

'writer.Flush()

xmlDoc.Load(stream.ToString)

Dim pdf As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()

'pdf.Save(stream)

pdf.IsImagesInXmlDeleteNeeded = True

pdf.CompressionLevel = 0

pdf.IsTruetypeFontMapCached = False

pdf.BindXML(xmlDoc, Nothing)

Return pdf

End Function

Hi there,


Thanks for your inquiry. I’m afraid DOC to PDF functionality is not supported in Aspose.Pdf. Please use Aspose.Words component for the purpose. Please check following documentation link for the purpose.


Please feel free to contact us for any further assistance.

Best Regards,

thanks for the update!!

I am now able to convert from doc to pdf.

Dim stream As IO.MemoryStream = New IO.MemoryStream

Dim pdfSaveOptions As New Aspose.Words.Saving.PdfSaveOptions()

pdfSaveOptions.SaveFormat = Aspose.Words.SaveFormat.Pdf

pdfSaveOptions.TempFolder = System.IO.Path.GetTempPath()

pdfSaveOptions.TextCompression = Aspose.Words.Saving.PdfTextCompression.Flate

pdfSaveOptions.JpegQuality = 100

doc.Save(stream, pdfSaveOptions)

stream.Flush()

stream.Seek(0, IO.SeekOrigin.Begin)

Dim pdf As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()

pdf.Save(stream)

pdf.IsImagesInXmlDeleteNeeded = True

pdf.CompressionLevel = 0

pdf.IsTruetypeFontMapCached = False

pdf.BindXML(stream, Nothing)

Return pdf

But the pdf that gets generated,only in the first page the image overlapped..the text..can you please let me know is there anyting that i m missing in code??

Hi,

Thanks for your inquiry. Could you please attach your input Word document and output PDF document showing the undesired behaviour here for testing? I will investigate the issue on my side and provide you more information.

Best regards,