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

Free Support Forum - aspose.com

Convert PDF to RTF

I created a PDF file using aspose.Pdf. for .Net I now want to convert that file to RTF.

Earlier posts (from 2008 thru 2011) said that to do so, you must convert from PDF ==> DOC ==> RTF.

1. Is that still the case or can PDF docs now (2017) be correctly converted from PDF ==> RTF?
2. Can you provide a simple example?

i.e. For example, is this pseudo code the right thought process? …
dim pdf as new pdf.document
dim t as textfragment(“hello world”)

dim doc as doc.document = opendocument(“text.pdf”)

Thank you.

Follow-up. I was able to get it to work once as follows:

Save PDF as DOCx file …
Dim pdf As New Aspose.Pdf.Document(strPDFfilename)
Dim SaveOptions As New Aspose.Pdf.DocSaveOptions()
SaveOptions.Mode = Aspose.Pdf.DocSaveOptions.RecognitionMode.Textbox
SaveOptions.Format = Aspose.Pdf.DocSaveOptions.DocFormat.DocX
SaveOptions.RecognizeBullets = True
pdf.Save(strDocFilename, SaveOptions)

Then Save DocX file as RTF …
Dim doc As New Aspose.Words.Document(strDocfilename)
doc.Save(strRTFfilename, Aspose.Words.SaveFormat.Rtf)

It worked once but now every time I try it, I get the out of memory error below.: My DOCX file is only 112K in size and I have 11GB of available memory. Not sure where to go with this next. I attached the DOC file I am trying to convert.

Exception of type ‘System.OutOfMemoryException’ was thrown.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.

Source Error:

<pre style=“font-family: Consolas, “Lucida Console”, monospace; font-size: 11pt; margin-top: 0px; margin-bottom: 0px; padding: 0.5em; line-height: 14pt;”>Line 1208: Dim strRTF As String = strTargetfile.Replace(".pdf", “.rtf”)
Line 1209: Dim doc As New Aspose.Words.Document(strDoc)
Line 1210: doc.Save(strRTF, Aspose.Words.SaveFormat.Rtf)
Line 1211:
Line 1212: CreateProgramPDf = True


Thank you for contacting support. We’re working over your query and will get back to you soon.


Thank you for being patient. There is no direct way to save a PDF into RTF format. You can convert a PDF to DOC using Aspose.Pdf API, and then DOC to RTF using Aspose.Words API. We have tested your source Word document against the latest version 17.02 of Aspose.Words API. We’re unable to replicate the out of memory error on our side. Please download and use the latest 17.02 of Aspose.Words API. If this does not help, then please prepare a simple console application which reproduces an error on your side and attach its zip archive in this forum thread. We’ll investigate and reply you appropriately.