Pure Java method for HTML to PDF conversion...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gregory Casamento

    #1

    Pure Java method for HTML to PDF conversion...

    I am currently looking for a way to convert HTML to PDF in Java. I
    cannot:

    1) use anything which is MS-Windows specific.
    2) Use an external server which processes the HTML -> PDF.

    Keeping these two requirements in mind, does anyone know of any
    product, or project which can do this?

    Also, I've tried Apache-FOP and it doesn't work very well. It *must*
    look the same way or at least very similar to how it does on the
    browser.

    Thanks in advance for any help you can offer. Please don't hesitate
    to email me at: greg_casamento@ yahoo.com if you know of something
    which may help.

    Thanks, GJC
  • Murray

    #2
    Re: Pure Java method for HTML to PDF conversion...


    "Gregory Casamento" <greg_casamento @yahoo.com> wrote in message
    news:ebde5706.0 407160907.e395d 59@posting.goog le.com...[color=blue]
    > I am currently looking for a way to convert HTML to PDF in Java. I
    > cannot:
    >
    > 1) use anything which is MS-Windows specific.
    > 2) Use an external server which processes the HTML -> PDF.
    >
    > Keeping these two requirements in mind, does anyone know of any
    > product, or project which can do this?
    >
    > Also, I've tried Apache-FOP and it doesn't work very well. It *must*
    > look the same way or at least very similar to how it does on the
    > browser.
    >
    > Thanks in advance for any help you can offer. Please don't hesitate
    > to email me at: greg_casamento@ yahoo.com if you know of something
    > which may help.
    >
    > Thanks, GJC[/color]

    I assume you mean open source? You can get pretty good results from FOP if
    you put in enough time getting the XSLT stylesheets right. But other than
    that I'm not aware of any projects that allow generic HTML -> PDF
    conversion. I'd be VERY interested if you find one though ...

    If you have money to burn, one product I've tried is Corda Highwire (trial
    version) - http://www.corda.com/products/highwire/ While it is intended to
    run as a server, IIRC it is possible to access its functionality directly
    through an API


    Comment

    • zef

      #3
      Re: Pure Java method for HTML to PDF conversion...

      > I'm not aware of any projects that allow generic HTML -> PDF[color=blue]
      > conversion. I'd be VERY interested if you find one though ...[/color]

      Try PD4ML! It's pure Java, it supports HTML 3.2 and CSS (to some
      extend). Free trial. Affordable price. http://pd4ml.zefer.org

      Comment

      • Murray

        #4
        Re: Pure Java method for HTML to PDF conversion...


        "zef" <pdf@zefer.or g> wrote in message
        news:2b18aeb0.0 407181313.34130 d7f@posting.goo gle.com...[color=blue][color=green]
        > > I'm not aware of any projects that allow generic HTML -> PDF
        > > conversion. I'd be VERY interested if you find one though ...[/color]
        >
        > Try PD4ML! It's pure Java, it supports HTML 3.2 and CSS (to some
        > extend). Free trial. Affordable price. http://pd4ml.zefer.org[/color]

        That's probably the cheapest all-in-one offering I've seen, but it's limited
        by the fairly basic HTML and CSS support of Swing's HTMLEditorKit. Do you
        have any plans to offer full HTML 4 compliance?

        I did something similar to your product a while ago using Swing and the
        freeware gnujpdf
        / Retep PDF II but was unhappy with the CSS limitations



        Comment

        • zef

          #5
          Re: Pure Java method for HTML to PDF conversion...

          > Do you have any plans to offer full HTML 4 compliance?

          Currently we have no such plans. The philosophy of PD4ML (if we can
          call it so) is to offer a sufficient and easy-to-use set of means to
          author PDF documents. First we are focused on the ability to get a
          desired end result, and only then on the acceptable input formats.

          HTML 3.2 is a bit outdated now, but it still allows to create using
          PD4ML a PDF layouts of almost any reasonable level of complexity. Our
          current customers successfully use PD4ML for dynamic generation of
          invoices, bank statements and phone bills.

          An ability to render any single HTML page you can find in Internet is
          not our goal in principle. For that deal fits better a variety of
          print drivers and converting tools based on MS IE or Mozilla rendering
          engines (although I am not sure, if there are any converting tools
          based on Mozilla).

          Zef

          Comment

          • Murray

            #6
            Re: Pure Java method for HTML to PDF conversion...


            "zef" <pdf@zefer.or g> wrote in message
            news:2b18aeb0.0 407190216.29d44 a73@posting.goo gle.com...[color=blue][color=green]
            > > Do you have any plans to offer full HTML 4 compliance?[/color]
            >
            > Currently we have no such plans. The philosophy of PD4ML (if we can
            > call it so) is to offer a sufficient and easy-to-use set of means to
            > author PDF documents. First we are focused on the ability to get a
            > desired end result, and only then on the acceptable input formats.[/color]

            Ah fair enough, that makes sense. Don't get me wrong, your product sounds
            good :-) Just not what I was after. i.e. a generic HTML --> PDF convertor. I
            think Sun have added better CSS support to HTMLEditorKit in JDK 1.5, I'll
            have to check it out when it's released.

            Thanks


            Comment

            • Gregory Casamento

              #7
              Re: Pure Java method for HTML to PDF conversion...

              "Murray" <parps@SPAMOFFo ptusnet.SPAMMAG E.com.au> wrote in message news:<40f8d8aa$ 0$18195$afc38c8 7@news.optusnet .com.au>...[color=blue]
              > "Gregory Casamento" <greg_casamento @yahoo.com> wrote in message
              > news:ebde5706.0 407160907.e395d 59@posting.goog le.com...[color=green]
              > > I am currently looking for a way to convert HTML to PDF in Java. I
              > > cannot:
              > >
              > > 1) use anything which is MS-Windows specific.
              > > 2) Use an external server which processes the HTML -> PDF.
              > >
              > > Keeping these two requirements in mind, does anyone know of any
              > > product, or project which can do this?
              > >
              > > Also, I've tried Apache-FOP and it doesn't work very well. It *must*
              > > look the same way or at least very similar to how it does on the
              > > browser.
              > >
              > > Thanks in advance for any help you can offer. Please don't hesitate
              > > to email me at: greg_casamento@ yahoo.com if you know of something
              > > which may help.
              > >
              > > Thanks, GJC[/color]
              >
              > I assume you mean open source?[/color]

              That would be best, but proprietary would do.
              [color=blue]
              > You can get pretty good results from FOP if
              > you put in enough time getting the XSLT stylesheets right. But other than
              > that I'm not aware of any projects that allow generic HTML -> PDF
              > conversion. I'd be VERY interested if you find one though ...[/color]

              I've already tried FOP. It works for straight HTML -> PDF given the
              right stylesheet, the best I tried was from Anntenna House. The
              issue is that the documents can contain CSS which the stylesheet isn't
              set up to read.
              [color=blue]
              > If you have money to burn, one product I've tried is Corda Highwire (trial
              > version) - http://www.corda.com/products/highwire/ While it is intended to
              > run as a server, IIRC it is possible to access its functionality directly
              > through an API[/color]

              I haven't looked at it. Thanks for the URL. :)

              GJC

              Comment

              • Rob

                #8
                Re: Pure Java method for HTML to PDF conversion...


                "Gregory Casamento" <greg_casamento @yahoo.com> wrote in message
                news:ebde5706.0 407160907.e395d 59@posting.goog le.com...[color=blue]
                > I am currently looking for a way to convert HTML to PDF in Java. I
                > cannot:
                >
                > 1) use anything which is MS-Windows specific.
                > 2) Use an external server which processes the HTML -> PDF.
                >
                > Keeping these two requirements in mind, does anyone know of any
                > product, or project which can do this?
                >
                > Also, I've tried Apache-FOP and it doesn't work very well. It *must*
                > look the same way or at least very similar to how it does on the
                > browser.
                >
                > Thanks in advance for any help you can offer. Please don't hesitate
                > to email me at: greg_casamento@ yahoo.com if you know of something
                > which may help.
                >
                > Thanks, GJC[/color]

                Hi -

                We've used this in the past, called from a JSP/Servlet (free except for
                support)


                java example


                Not sure if thats what you meant by 'external server', if so, sorry
                Cheers
                Rob


                Comment

                • Randolf Richardson

                  #9
                  Re: Pure Java method for HTML to PDF conversion...

                  ""Rob" <rob@home.net.a u>" wrote in comp.lang.java:
                  [color=blue]
                  > "Gregory Casamento" <greg_casamento @yahoo.com> wrote in message
                  > news:ebde5706.0 407160907.e395d 59@posting.goog le.com...
                  >[color=green]
                  >> I am currently looking for a way to convert HTML to PDF in Java. I
                  >> cannot:
                  >>
                  >> 1) use anything which is MS-Windows specific.
                  >> 2) Use an external server which processes the HTML -> PDF.
                  >>
                  >> Keeping these two requirements in mind, does anyone know of any
                  >> product, or project which can do this?[/color][/color]

                  In addition to Rob's answer, try a Google.Com search; there seem to be
                  a lot of different options:

                  Google.Com: +html2pdf +java

                  [color=blue][color=green]
                  >> Also, I've tried Apache-FOP and it doesn't work very well. It *must*
                  >> look the same way or at least very similar to how it does on the
                  >> browser.[/color][/color]
                  [sNip]

                  Which web browser? The problem is that each web browser renders web
                  pages somewhat differently, and then on different Operating Systems, which
                  can have different sets of default fonts and other display mode
                  differences, you'll see even more variety.

                  Your best bet will be to convert as close to the specifications as
                  possible, rather than trying to mimic a specific web browser. The code
                  that performs the conversion will probably be a lot cleaner too.

                  Comment

                  Working...