Skip to main content
Known Participant
June 15, 2009
Question

Convert PDF to HTML

  • June 15, 2009
  • 2 replies
  • 4464 views

Does anyone know if there is a way in ColdFusion to convert the contents of a PDF into HTML to use where needed in my CF app? I am auto generating a huge PDF file using CFDOCUMENT. I need a way to take the contents of an existing PDF, which is basically just a table with some data in it and insert it in a specific spot in the master PDF. I do not want to do a "merge" of multiple PDF's, I know how to do that. I actually need to take the contents of one PDF and insert it in a specific spot in the PDF I am creating. I don't know if this is even possible.

    This topic has been closed for replies.

    2 replies

    Participating Frequently
    June 18, 2009

    I think you can use CF8 and DDX to build your new PDF. Something like

    this (not tested):

    
    	
    	
    	
    
    ...
    ]]>

    Mack

    Known Participant
    June 18, 2009

    I've actually tried that, but what that does is put the source PDF's one right after another. So yes I could dynamically create one PDF and then "merge" that PDF with other already created PDF's in to one big PDF. What I need to do though is actually "paste" the contents of one PDF into the PDF that I am creating with CFDOCUMENT. Think cfinclude. So as I am creating a dynamic PDF with cfdocument adding text and headers etc, I need to go grab the contents of a PDF which in this case is just a table of data and insert it into a page of my PDF and then immediately after the table continue adding content on the same PDF page. I don't want the included content to be its own page. I can use cfpdf and do "merge" to accomplish that. I am slowly starting to realize that this isn't possible, but if anyone else has any ideas let me know

    THANKS

    Inspiring
    June 18, 2009

    ehaemmerle wrote:

    I need to go grab the contents of a PDF which in this case is just a table of data and insert it into a page of my PDF and then immediately after the table continue adding content on the same PDF page. I don't want the included content to be its own page. I can use cfpdf and do "merge" to accomplish that. I am slowly starting to realize that this isn't possible, but if anyone else has any ideas let me know

    THANKS

    While there are tools for converting pdf to html (with varying levels of success),  it sounds like more complexity than is needed.  You might try a simpler approach.  Convert the second pdf to an image, then insert the _image_ of the page instead.  You may need to crop it, but it might do the trick.

    BTW, how is the second pdf created? Since you posted this question, I am assuming you are not creating it yourself with cfdocument ;-)

    Dileep_NR
    Inspiring
    June 17, 2009

    hi,

        1) Firstly you read the master PDF into variable

         2) Paste variable(in step 1 variable) content to the desired location in the CFDOCUMENT  while creating the huge pdf file.

    Hope this will help you

    Known Participant
    June 17, 2009

    So I did a CFFILE and read the PDF into a variable, but when I CFOUTPUT it into the main PDF, it's just gibberish on the screen. I'm assuming there must be some kind of conversion I need to do?