Convert PDF to DOC and DOCX in C++

aspose-pdf-for-cpp

Aspose.PDF for C++ API lets you read and convert PDF documents to Microsoft Word’s DOC and DOCX file formats. C++ is one of the widely-used programming languages for writing fast and interoperable code that can be executed on a number of platforms. C++ application developers can use Aspose.PDF for C++ to write programs that can manipulate PDF documents without the need of installing any other software on end-user machines.

In this post, we will demonstrate the powerful features of Aspose.PDF for C++ API to read and convert PDF files to DOC and DOCX file formats.

Convert PDF to DOC

Aspose.PDF for C++ SDK lets you read a PDF file and convert it to Microsoft Word Binary file format (.doc) with just a couple of lines. The Document class of the API lets you read a PDF file from disc or stream, use the Save method for saving it in different file formats. Use the SaveFormat enumeration to specify the output file format as shown in the code sample below.

auto doc = MakeObject<Document>(u"..\\Data\\Document\\input.pdf");
doc->Save(u"..\\Data\\Document\\input_out.doc", SaveFormat:: Doc);

Convert PDF to DOCX

DOCX is the modern Word Documents file format that is based on Office Open XML file format specifications. Aspose.PDF for C++ can convert PDF files to DOCX with the same simplicity as it converts to DOC file format. This is as illustrated in the following sample code.

auto doc = MakeObject<Document>(u"..\\Data\\Document\\input.pdf");
doc->Save(u"..\\Data\\Document\\input_out.docx", SaveFormat::DocX);

In a nutshell, the API lets you convert PDF files to several other file formats without you being worried about the underlying document architecture of source and output file formats. Want to try it out? Download your free copy of the Aspose.PDF for C++ API and get started in no time by following the detailed developer guide from API documentation. In case of any queries, feel free to write to us on Aspose.PDF forum to get further assistance.