You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Raj Bahadur <ra...@gmail.com> on 2016/11/21 14:21:54 UTC

Need a sample application to convert PDF File to HTML File in 2.0

Hello Dev Team,

I have a requirement to convert the PDF File to HTML File, I have searched
in google but not getting any response.

Can you, please share any sample to so that I can implement in our project.

Appreciate your help, as we are running out of time.

Regards,
Rah

Re: Need a sample application to convert PDF File to HTML File in 2.0

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 21.11.2016 um 15:21 schrieb Raj Bahadur:
> Hello Dev Team,
>
> I have a requirement to convert the PDF File to HTML File, I have searched
> in google but not getting any response.
https://pdfbox.apache.org/2.0/commandline.html#extracttext

the "-html" does convert to HTML. So download the sources, and look at 
the ExtractText.java source code.

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Need a sample application to convert PDF File to HTML File in 2.0

Posted by Sergio Muriel <se...@hotmail.com>.
Download pdfbox-2.0.3.jar, fontbox-2.0.3.jar, preflight-2.0.3.jar, xmpbox-2.0.3.jar, pdfbox-tools-2.0.3.jar and pdfbox-debugger-2.0.3.jar
from http://pdfbox.apache.org/

Then:

 import java.io.InputStream;
 import java.io.IOException;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.tools.PDFText2HTML;

    // .....
    try {
        InputStream is = // ..... Read PDF file
        PDDocument pdd = PDDocument.load(is); //This is the in-memory representation of the PDF document.
        PDFText2HTML converter = new PDFText2HTML(); // the converter
        String html = converter.getText(pdd); // That's it!
        pdd.close();
        is.close();
    } catch (IOException ioe) {
        // ......
    }


Please note: Images do not get pushed to the HTML output.


Best Regards,
Sergio Muriel



________________________________
From: Raj Bahadur <ra...@gmail.com>
Sent: Monday, November 21, 2016 8:21 AM
To: dev@pdfbox.apache.org; users@pdfbox.apache.org; commits@pdfbox.apache.org
Subject: Need a sample application to convert PDF File to HTML File in 2.0

Hello Dev Team,

I have a requirement to convert the PDF File to HTML File, I have searched
in google but not getting any response.

Can you, please share any sample to so that I can implement in our project.

Appreciate your help, as we are running out of time.

Regards,
Rah