How to use iText java PDF library with PHP?











up vote
3
down vote

favorite
1












Google search results suggested that it's possible via PHP/Java Bridge . This bridge requires Java Application Server. My host (bluehost) does not allow to run any Java Application Server. What are the alternatives in this case to make iText work? Switching a host is not viable option for me.



Thanks.










share|improve this question






















  • If you are on shared hosting that doesn't run Java, I don't think this can be done at all.
    – Pekka 웃
    Dec 8 '10 at 17:59






  • 1




    If java is not installed, there is not much you can do. Your best bet is probably a PHP based PDF library, see here: php.net/manual/en/faq.using.php#faq.using.freepdf
    – Max
    Dec 8 '10 at 18:46






  • 2




    Hey, if you're generating PDFs, I can fairly strongly recommend wkhtmltopdf which uses the super-awesome webkit rendering engine to render html documents to pdf. It has few external dependencies, so it's pretty easy to get going. It's what pdfmyurl uses, so you can try that out if you want to test your results.
    – davidtbernal
    Dec 8 '10 at 18:52










  • A related question stackoverflow.com/questions/1648715/…
    – Jaydee
    Jun 9 '14 at 14:30















up vote
3
down vote

favorite
1












Google search results suggested that it's possible via PHP/Java Bridge . This bridge requires Java Application Server. My host (bluehost) does not allow to run any Java Application Server. What are the alternatives in this case to make iText work? Switching a host is not viable option for me.



Thanks.










share|improve this question






















  • If you are on shared hosting that doesn't run Java, I don't think this can be done at all.
    – Pekka 웃
    Dec 8 '10 at 17:59






  • 1




    If java is not installed, there is not much you can do. Your best bet is probably a PHP based PDF library, see here: php.net/manual/en/faq.using.php#faq.using.freepdf
    – Max
    Dec 8 '10 at 18:46






  • 2




    Hey, if you're generating PDFs, I can fairly strongly recommend wkhtmltopdf which uses the super-awesome webkit rendering engine to render html documents to pdf. It has few external dependencies, so it's pretty easy to get going. It's what pdfmyurl uses, so you can try that out if you want to test your results.
    – davidtbernal
    Dec 8 '10 at 18:52










  • A related question stackoverflow.com/questions/1648715/…
    – Jaydee
    Jun 9 '14 at 14:30













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





Google search results suggested that it's possible via PHP/Java Bridge . This bridge requires Java Application Server. My host (bluehost) does not allow to run any Java Application Server. What are the alternatives in this case to make iText work? Switching a host is not viable option for me.



Thanks.










share|improve this question













Google search results suggested that it's possible via PHP/Java Bridge . This bridge requires Java Application Server. My host (bluehost) does not allow to run any Java Application Server. What are the alternatives in this case to make iText work? Switching a host is not viable option for me.



Thanks.







php pdf itext application-server






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 8 '10 at 17:55









understack

4,338216394




4,338216394












  • If you are on shared hosting that doesn't run Java, I don't think this can be done at all.
    – Pekka 웃
    Dec 8 '10 at 17:59






  • 1




    If java is not installed, there is not much you can do. Your best bet is probably a PHP based PDF library, see here: php.net/manual/en/faq.using.php#faq.using.freepdf
    – Max
    Dec 8 '10 at 18:46






  • 2




    Hey, if you're generating PDFs, I can fairly strongly recommend wkhtmltopdf which uses the super-awesome webkit rendering engine to render html documents to pdf. It has few external dependencies, so it's pretty easy to get going. It's what pdfmyurl uses, so you can try that out if you want to test your results.
    – davidtbernal
    Dec 8 '10 at 18:52










  • A related question stackoverflow.com/questions/1648715/…
    – Jaydee
    Jun 9 '14 at 14:30


















  • If you are on shared hosting that doesn't run Java, I don't think this can be done at all.
    – Pekka 웃
    Dec 8 '10 at 17:59






  • 1




    If java is not installed, there is not much you can do. Your best bet is probably a PHP based PDF library, see here: php.net/manual/en/faq.using.php#faq.using.freepdf
    – Max
    Dec 8 '10 at 18:46






  • 2




    Hey, if you're generating PDFs, I can fairly strongly recommend wkhtmltopdf which uses the super-awesome webkit rendering engine to render html documents to pdf. It has few external dependencies, so it's pretty easy to get going. It's what pdfmyurl uses, so you can try that out if you want to test your results.
    – davidtbernal
    Dec 8 '10 at 18:52










  • A related question stackoverflow.com/questions/1648715/…
    – Jaydee
    Jun 9 '14 at 14:30
















If you are on shared hosting that doesn't run Java, I don't think this can be done at all.
– Pekka 웃
Dec 8 '10 at 17:59




If you are on shared hosting that doesn't run Java, I don't think this can be done at all.
– Pekka 웃
Dec 8 '10 at 17:59




1




1




If java is not installed, there is not much you can do. Your best bet is probably a PHP based PDF library, see here: php.net/manual/en/faq.using.php#faq.using.freepdf
– Max
Dec 8 '10 at 18:46




If java is not installed, there is not much you can do. Your best bet is probably a PHP based PDF library, see here: php.net/manual/en/faq.using.php#faq.using.freepdf
– Max
Dec 8 '10 at 18:46




2




2




Hey, if you're generating PDFs, I can fairly strongly recommend wkhtmltopdf which uses the super-awesome webkit rendering engine to render html documents to pdf. It has few external dependencies, so it's pretty easy to get going. It's what pdfmyurl uses, so you can try that out if you want to test your results.
– davidtbernal
Dec 8 '10 at 18:52




Hey, if you're generating PDFs, I can fairly strongly recommend wkhtmltopdf which uses the super-awesome webkit rendering engine to render html documents to pdf. It has few external dependencies, so it's pretty easy to get going. It's what pdfmyurl uses, so you can try that out if you want to test your results.
– davidtbernal
Dec 8 '10 at 18:52












A related question stackoverflow.com/questions/1648715/…
– Jaydee
Jun 9 '14 at 14:30




A related question stackoverflow.com/questions/1648715/…
– Jaydee
Jun 9 '14 at 14:30












4 Answers
4






active

oldest

votes

















up vote
0
down vote













There's always iTextSharp, a C# translation of iText. Will your host let you run C#?



It looks like you can call C# from PHP, as detailed here.






share|improve this answer

















  • 1




    Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
    – Max
    Dec 8 '10 at 18:43










  • 2002? Eek! Well I doubt it's harder to connect the two now.
    – Mark Storer
    Dec 8 '10 at 18:54










  • Just checked, C# is not an option either. I guess, I've to look for other libraries.
    – understack
    Dec 8 '10 at 19:03


















up vote
0
down vote













I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).



Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.



I have not had any performance issues using this approach myself, YMMV



(It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)



Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)






share|improve this answer




























    up vote
    0
    down vote













    The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version



    I have used the Java Itext, Its superb!!






    share|improve this answer




























      up vote
      -1
      down vote













      PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.






      share|improve this answer





















      • Pdftk is a front end to a very, very, very old version of iText.
        – Amedee Van Gasse
        Jun 2 '16 at 6:07











      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4390675%2fhow-to-use-itext-java-pdf-library-with-php%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      There's always iTextSharp, a C# translation of iText. Will your host let you run C#?



      It looks like you can call C# from PHP, as detailed here.






      share|improve this answer

















      • 1




        Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
        – Max
        Dec 8 '10 at 18:43










      • 2002? Eek! Well I doubt it's harder to connect the two now.
        – Mark Storer
        Dec 8 '10 at 18:54










      • Just checked, C# is not an option either. I guess, I've to look for other libraries.
        – understack
        Dec 8 '10 at 19:03















      up vote
      0
      down vote













      There's always iTextSharp, a C# translation of iText. Will your host let you run C#?



      It looks like you can call C# from PHP, as detailed here.






      share|improve this answer

















      • 1




        Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
        – Max
        Dec 8 '10 at 18:43










      • 2002? Eek! Well I doubt it's harder to connect the two now.
        – Mark Storer
        Dec 8 '10 at 18:54










      • Just checked, C# is not an option either. I guess, I've to look for other libraries.
        – understack
        Dec 8 '10 at 19:03













      up vote
      0
      down vote










      up vote
      0
      down vote









      There's always iTextSharp, a C# translation of iText. Will your host let you run C#?



      It looks like you can call C# from PHP, as detailed here.






      share|improve this answer












      There's always iTextSharp, a C# translation of iText. Will your host let you run C#?



      It looks like you can call C# from PHP, as detailed here.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Dec 8 '10 at 18:39









      Mark Storer

      13.5k13064




      13.5k13064








      • 1




        Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
        – Max
        Dec 8 '10 at 18:43










      • 2002? Eek! Well I doubt it's harder to connect the two now.
        – Mark Storer
        Dec 8 '10 at 18:54










      • Just checked, C# is not an option either. I guess, I've to look for other libraries.
        – understack
        Dec 8 '10 at 19:03














      • 1




        Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
        – Max
        Dec 8 '10 at 18:43










      • 2002? Eek! Well I doubt it's harder to connect the two now.
        – Mark Storer
        Dec 8 '10 at 18:54










      • Just checked, C# is not an option either. I guess, I've to look for other libraries.
        – understack
        Dec 8 '10 at 19:03








      1




      1




      Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
      – Max
      Dec 8 '10 at 18:43




      Just my opinion, but if Java is not allowed, I think its highly unlikely that there is a .NET Framework environment where C# apps run. And the COM interface of PHP is not really something you want to use. By the way, the article is from 2002.
      – Max
      Dec 8 '10 at 18:43












      2002? Eek! Well I doubt it's harder to connect the two now.
      – Mark Storer
      Dec 8 '10 at 18:54




      2002? Eek! Well I doubt it's harder to connect the two now.
      – Mark Storer
      Dec 8 '10 at 18:54












      Just checked, C# is not an option either. I guess, I've to look for other libraries.
      – understack
      Dec 8 '10 at 19:03




      Just checked, C# is not an option either. I guess, I've to look for other libraries.
      – understack
      Dec 8 '10 at 19:03












      up vote
      0
      down vote













      I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).



      Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.



      I have not had any performance issues using this approach myself, YMMV



      (It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)



      Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)






      share|improve this answer

























        up vote
        0
        down vote













        I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).



        Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.



        I have not had any performance issues using this approach myself, YMMV



        (It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)



        Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)






        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).



          Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.



          I have not had any performance issues using this approach myself, YMMV



          (It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)



          Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)






          share|improve this answer












          I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).



          Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.



          I have not had any performance issues using this approach myself, YMMV



          (It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)



          Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 23 '14 at 6:12









          Michael Mügge

          3,83312030




          3,83312030






















              up vote
              0
              down vote













              The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version



              I have used the Java Itext, Its superb!!






              share|improve this answer

























                up vote
                0
                down vote













                The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version



                I have used the Java Itext, Its superb!!






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version



                  I have used the Java Itext, Its superb!!






                  share|improve this answer












                  The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version



                  I have used the Java Itext, Its superb!!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 8 at 9:10









                  jsraymond

                  11




                  11






















                      up vote
                      -1
                      down vote













                      PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.






                      share|improve this answer





















                      • Pdftk is a front end to a very, very, very old version of iText.
                        – Amedee Van Gasse
                        Jun 2 '16 at 6:07















                      up vote
                      -1
                      down vote













                      PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.






                      share|improve this answer





















                      • Pdftk is a front end to a very, very, very old version of iText.
                        – Amedee Van Gasse
                        Jun 2 '16 at 6:07













                      up vote
                      -1
                      down vote










                      up vote
                      -1
                      down vote









                      PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.






                      share|improve this answer












                      PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 1 '16 at 23:29









                      bmb

                      4,78113152




                      4,78113152












                      • Pdftk is a front end to a very, very, very old version of iText.
                        – Amedee Van Gasse
                        Jun 2 '16 at 6:07


















                      • Pdftk is a front end to a very, very, very old version of iText.
                        – Amedee Van Gasse
                        Jun 2 '16 at 6:07
















                      Pdftk is a front end to a very, very, very old version of iText.
                      – Amedee Van Gasse
                      Jun 2 '16 at 6:07




                      Pdftk is a front end to a very, very, very old version of iText.
                      – Amedee Van Gasse
                      Jun 2 '16 at 6:07


















                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4390675%2fhow-to-use-itext-java-pdf-library-with-php%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Coverage of Google Street View

                      Full-time equivalent

                      Surfing