in reply to Can I convert a pdf to html with PDF::Extract??

There's a great example snippet in the POD for PDF::Extract:

use PDF::Extract; $pdf = new PDF::Extract( PDFDoc=>'C:/my.pdf' ); $pdf->getPDFExtract( PDFPages=>$PDFPages ); print "Content-Type text/plain\n\n<xmp>", $pdf->getVars("PDFExtract" +); print $pdf->getVars("PDFError"); # or # Extract and save, in the current directory, all the pages in a pdf +document use PDF::Extract; $pdf=new PDF::Extract( PDFDoc=>"test.pdf"); $i=1; $i++ while ( $pdf->savePDFExtract( PDFPages=>$i ) );

Update to provide more thorough information:

The POD also discusses the following:

With PDF::Extract a new PDF document can be:-

So I guess the short answer is that yes, this is an appropriate tool for the job. The example under the heading servePDFExtract shows how to output to STDOUT with the correct header for a PDF document served on the web.


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein

Replies are listed 'Best First'.
Re: Re: How can I convert a pdf to html with PDF::Extract?
by Anonymous Monk on Nov 28, 2003 at 08:28 UTC
    That's amazing, how did you know to read the documentation?
Re: Re: How can I convert a pdf to html with PDF::Extract?
by Anonymous Monk on Nov 28, 2003 at 08:56 UTC
    Hi, You mean to say that in the subroutines of savePDFExtract by changing the .pdf extension to .html will do the task for me . Can u explain in detail how it can be achieved as per ur sayings . Thankyou !
      No, I mean to say that the following snippet will output a complete PDF content header, followed by the PDF document that you've extracted, for the webserver to serve up to the HTTP client.

      $pdf = PDF::Extract->new( PDFDoc=>'C:/my.pdf', PDFErrorPage=>"C:/myErrorPage.html" ); $pdf->servePDFExtract( PDFPages=>1);


      Dave


      "If I had my life to live over again, I'd be a plumber." -- Albert Einstein
        Hi, I tries it but I get error as follows:

        There is system problem in processing your PDF Pages request

        <xmp>ERROR:There are no pages in adminhelp.pdf that match '' at/usr/lib/perl5/site_perl/5.8.1/PDF/Extract.pm 570 </xmp> My major aim is to just convert the .pdf file into .html file .The spacing of graphics and text should be proper . How is it possible . Thanks for ur previos sugestions .
Re: Re: How can I convert a pdf to html with PDF::Extract?
by Anonymous Monk on Nov 28, 2003 at 09:33 UTC
    Hi, When I use servePDFExtract and output to STDOUT will it help me to get the form in html . When I do that I get some output which is absurd and not in plain nor html form . Can you just let me know how I can achieve the task to get the pdf file converted to html file along with graphics. Please direct me in this task with a few samples of code to chieve it . Thankyou !
      I understood you as needing to extract and display a PDF page on a web browser, and for that, the PDF::Extract module is on target. HTML::HTMLDoc::PDF would also be appropriate for that use. But for file format conversion, from PDF to HTML, which I'm now understanding is what you're trying to do, that's a different story, and a bit more difficult.

      You could use PDF::Parse to disect the PDF file. But turning the output of PDF::Parse into HTML is work. Especially considering that some PDF files can be encrypted, rendering many of the PDF::Parse functions useless.

      There are programs out there already that do the conversion for you, without requiring you to toil over trying to roll your own converter. this seems to be one possibility. There is another one here. The second one listed here is shareware with a free trial period. And Googling for "pdf to html conversion" turns up droves.

      Of course they're not geared for doing it "on the fly". But it's also not a quick, on-the-fly type of process. Converting dynamically, on demand, would drive server load through the roof. It's something best done once, and for that, why not use an already completed solution?


      Dave


      "If I had my life to live over again, I'd be a plumber." -- Albert Einstein
        Hi, Can u give me a concrete answer on converting pdf to html . Decrypting pdf is not easy . Can I do it this way . Convert pdf to pod and then pod to html. But i m not sure whether there exists a module to convert pdf to pod . I will be thankful if u support ur answer with a few links where I can get some useful information . Thanks for ur previous help.