Updates

Introducing ComPDFKit Conversion SDK 1.5.0

By ComPDFKit | Fri. 17 May. 2024
ReleaseConversion SDK

ComPDFKit Conversion SDK 1.5.0 has been released! With this version, users’ needs for converting PDF to RTF and converting PDF to HTML are satisfied. In this blog post, we will give a detailed introduction to these two formats and show you how to convert PDF to RTF and HTML.

 

 

PDF to RTF

 

Although PDF is a secure format to send and share your files, it is difficult to open PDF files if you share them with someone who doesn't have any PDF processors. To make sure that anyone can open and read the files, you can choose to convert PDF to RTF.

 

What Is RTF

 

RTF, short for Rich Text Format, was created by the Microsoft Word team in 1987. It was intended as a universal format that could be supported by most word processors. 

 

Different from TXT, RTF can include more information. You can choose the font (style, size, color), add images, set page formatting options, create tables, and more. RTF can be opened with any text editors that come with your computer, which makes it an excellent choice for cross-platform document sharing and exchange. That means if you create an RTF file on Mac, you’ll be able to send it to a colleague who uses Windows, Linux, or ChromeOS without any problems. 

 

Pros and Cons of RTF

 

Pros

- The main advantage of RTF is its compatibility. RTF files created in different operating systems can be transferred and viewed in multiple operating systems and applications. RTF files can be read and saved by most word-processing software.

- RTF files allow you to set options of content, like font style, formatting, images, etc., providing you with a better reading experience.

- Microsoft Word files are less trusted by business organizations or email servers as they can contain macro viruses. While RTF files do not use macros, which means they can’t easily carry any viruses or malware.

 

Cons

- RTF files are not compressed, so their sizes are much larger than corresponding Word files. This is terrible as these files need more time to download/upload and more space to store.

- RTF files cannot be protected by password, so they are not recommended if your documents contain confidential or private information.

 

How to Convert

 

With ComPDFKit, you can convert PDF to RTF effortlessly. Here we take C# as an example. 

string resPath = "***";
string inputFilePath = "***";
string outputFolderPath = "***";
string outputFileName = "***";

CPDFConverter.Init(resPath);
CPDFConverterRTF converter = new CPDFConverterRTF(inputFilePath);

int pageCount = converter.GetPagesCount();
int[] pageArray = new int[pageCount];
for (int i = 0; i < pageArray.Length; i++)
{
    pageArray[i] = i + 1;
}

ConvertError error = ConvertError.ERR_UNKNOWN;
converter.Convert(outputFolderPath, ref outputFileName, pageArray, ref error, getPorgress);

 

 

PDF to HTML

 

Converting PDF to HTML can make people easily find the content of your document in a web search, which ensures your content reaches a wider audience.

 

What Is HTML

 

HTML stands for Hypertext markup language. It is a standard markup language designed to display documents online in a browser, and it also helps to create the structure of web pages. HTML consists of many tags including displaying text, tables, ordered lists and unordered lists, etc. If you want to learn more about HTML, please click here.

 

Why Convert PDF to HTML

 

- HTML is browser-friendly, it is supported by all browsers, such as IE, Google Chrome, Opera Mini, and Mozilla Firefox.

- Instead of waiting and downloading a PDF file, users can read everything directly in the browser.

- PDF files aren’t easily shared on social media like Facebook, Twitter, and LinkedIn.

- It’s difficult to link to a specific page in a PDF document.

 

How to Convert

 

See how to use ComPDFKit to convert PDF to HTML in C#.

string resPath = "***";
string inputFilePath = "***";
string outputFolderPath = "***";
string outputFileName = "***";

CPDFConvertHTMLOptions htmlOptions = new CPDFConvertHTMLOptions();
htmlOptions.pageAndNavigationPaneOpts = PageAndNavigationPaneOptions.SinglePageNavigationByBookmarks;

CPDFConverter.Init(resPath);
CPDFConverterHTML converter = new CPDFConverterHTML(inputFilePath);

int pageCount = converter.GetPagesCount();
int[] pageArray = new int[pageCount];
for (int i = 0; i < pageArray.Length; i++)
{
    pageArray[i] = i + 1;
}

ConvertError error = ConvertError.ERR_UNKNOWN;
converter.Convert(outputFolderPath, ref outputFileName, htmlOptions, pageArray, ref error, getPorgress);

 

 

Conclusion

 

After reading this article, you may have a general understanding of RTF and HTML. Besides the two formats, ComPDFKit Conversion SDK also supports many other formats with accurate effects. Contact us to download our SDK and start converting your files right now.