Convert PUB to Word Document DOC or DOCX Programmatically in Java

Convert Export PUB to Word DOCX

In this article, you will learn how to convert or export an MS Publisher PUB file to an MS Word Document in DOCX or DOC format. The step-by-step guide will demonstrate all the details about the conversion:

Java APIs to Convert PUB file to Word Document as DOC/DOCX

You will convert a PUB file to a Word document in two steps. First, you convert a PUB file to PDF using Aspose.PUB for Java API. Then you convert the PDF file to a Word document using Aspose.PDF for Java API. You can download the JAR files from the New Releases section, or specify the following configurations in the pom.xml file of your Maven-based projects:

Repository

 <repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <name>Aspose Java API</name>
        <url>http://repository.aspose.com/repo/</url>
    </repository>
</repositories>

Dependency

 <dependencies>

    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-pub</artifactId>
        <version>20.8</version>
    </dependency>

    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-pdf</artifactId>
        <version>21.8</version>
    </dependency>

</dependencies>

Convert PUB File to Word Document DOCX DOC Programmatically in Java

You can convert a Microsoft Publisher PUB file to a Word Document in DOCX or DOC format with the following steps:

  1. Firstly, initialize ByteArrayOutputStream to hold intermediary file.
  2. Initialize Pub Parser for the PUB file.
  3. Parse the input Publisher file.
  4. Convert PUB to PDF file and save output into the stream.
  5. Load the intermediary PDF document with Document class object.
  6. Finally, convert the file to MS Word DOCX or DOC format with the Save method.

The code below explains how to convert or export a PUB file to a Word document in DOCX DOC format programmatically using Java:

Get Free API License

You can evaluate the Aspose APIs without any limitations by requesting a Free Temporary License.

Conclusion

In conclusion, you have learned how to convert or export Microsoft Publisher PUB file to a Word document as DOC or DOCX file programmatically using Java. You can integrate this feature in any of your Java-based applications. Moreover, you can explore several other features offered by Aspose APIs by visiting the Documentation. In case of any concerns, please feel free to contact us at the Free Support Forum. Happy coding!

See Also

Convert PUB to Image Programmatically in Java