Skip to content
Guides

Convert PDF to RTF

Overview

RTF is a popular text format that can retain the format and style data of the text, and it is convenient for most text readers to read and write. Integrate ComPDFKit Conversion SDK to conevert PDFs to RTF files now.

Sample

This sample demonstrates how to convert PDFs to RTF files.

java
        CPDFConvert  cpdfConvertRTF = new CPDFConvertRTF();
        CPDFConvertRTFOptions cpdfConvertRTFOptions = new CPDFConvertRTFOptions();
        cpdfConvertRTFOptions.setContainAnnot(true);
        cpdfConvertRTFOptions.setContainImg(true);
        String inputPath = rootDir + input_file + "word.pdf";
        List<Integer> pageCounts = getPageCounts(cpdfConvertRTF.getPageCount(inputPath, password));
        ConvertResult convert = cpdfConvertRTF.convert(inputPath, rootDir + output_file, "", cpdfConvertRTFOptions, pageCounts, password, page -> {
        });