Copy link to clipboard
I am working on converting the PDF into a HTML document. Using the Adobe export API I could convert my PDF into .docx or .png files but I couldn't find any documentation to convert into HTML format. I see that in the Adobe DC application I was able to convert the PDF to HTML and I was hoping this would be possible using the API. Is there any documentation or any way I could use to convert the PDF to HTML?
Copy link to clipboard
The Extract API will output JSON which can easily be used to generate HTML on the fly.
Thanks for the reply. Actually that is a great approach, extracting the JSON and generating the HTML from it. I will take a look at the JSON output and try to use it to generate the HTML.
Could you suggest me any resources or any process to do this task. I was searching online and all I could find is converting the JSON into HTML tables.
Extract will product a JSON with an elements property. The elements is an array of objects that corresponds to each "chunk" of text in the PDF. There are two properties in each element that will be of interest when creating the HTML. The Path and the Text. The Path will end in one of the element types listed here. Most of them are also HTML element names that you'll be familiar with. The Text is... you guessed it... the text of that element.
Tables and Lists get interesting but those are still pretty easy to read. That said, you can extract the tables as CSV and then easily render those to HTML. There are number of code samples that will do that for you.
I'll be sharing some code that I have that does this soon.
I used the normal text extract(without any styling) output from the Extract API, and was able to convert into a HTML using the properties. In the JSON output(text extract without any styling information) the list elements are considered as heading tags so didn't have to worry about them but tables took some time to figure out. I couldn't understand how to use the font data and also the background color information because of their format. That being said, so far my HTML looks far more better than any other software or packages that I used.
Could you share the code you were saying so that I could have even better understanding and also could improve my approach. Thanks.
Curious to see the business logic on how you have rendered the HTML from JSON output. Can you point me to the code samples, please? Thanks a ton
Did you find any framework or API which will create HTML from Json output?