473,392 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,392 software developers and data experts.

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: gr************@yahoo.com if you know of something
which may help.

Thanks, GJC
Jul 17 '05 #1
8 38524

"Gregory Casamento" <gr************@yahoo.com> wrote in message
news:eb*************************@posting.google.co m...
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: gr************@yahoo.com if you know of something
which may help.

Thanks, GJC


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
Jul 17 '05 #2
zef
> I'm not aware of any projects that allow generic HTML -> PDF
conversion. I'd be VERY interested if you find one though ...


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

"zef" <pd*@zefer.org> wrote in message
news:2b**************************@posting.google.c om...
I'm not aware of any projects that allow generic HTML -> PDF
conversion. I'd be VERY interested if you find one though ...


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


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

Jul 17 '05 #4
zef
> 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
Jul 17 '05 #5

"zef" <pd*@zefer.org> wrote in message
news:2b**************************@posting.google.c om...
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.


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
Jul 17 '05 #6
"Murray" <pa***@SPAMOFFoptusnet.SPAMMAGE.com.au> wrote in message news:<40***********************@news.optusnet.com. au>...
"Gregory Casamento" <gr************@yahoo.com> wrote in message
news:eb*************************@posting.google.co m...
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: gr************@yahoo.com if you know of something
which may help.

Thanks, GJC
I assume you mean open source?


That would be best, but proprietary would do.
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 ...
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.
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


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

GJC
Jul 17 '05 #7
Rob

"Gregory Casamento" <gr************@yahoo.com> wrote in message
news:eb*************************@posting.google.co m...
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: gr************@yahoo.com if you know of something
which may help.

Thanks, GJC


Hi -

We've used this in the past, called from a JSP/Servlet (free except for
support)
http://www.easysw.com/htmldoc/

java example
http://www.easysw.com/htmldoc/htmldoc.html#6_6

Not sure if thats what you meant by 'external server', if so, sorry
Cheers
Rob
Jul 17 '05 #8
""Rob" <ro*@home.net.au>" wrote in comp.lang.java:
"Gregory Casamento" <gr************@yahoo.com> wrote in message
news:eb*************************@posting.google.co m...
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?
In addition to Rob's answer, try a Google.Com search; there seem to be
a lot of different options:

Google.Com: +html2pdf +java
http://www.google.com/search?q=%2Bhtml2pdf+%2Bjava
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.

[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.
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sarah chang | last post by:
I want to implement a variety of SOAP methods (with Apache SOAP) using just one method of one Java class, with the SOAP method name passed as a parameter to the Java method and the SOAP parameters...
6
by: Robbie Baldock | last post by:
Hi - I'm a bit of a newbie to the world of XSLTs but am trying to call a Java method on a parameter passed into an XSLT but am having problems. I've stripped the XSLT down to its bare bones: ...
2
by: Neil Cherry | last post by:
I've done a fair amount of searching on this subject and I can call my Java methods with Javascript if I use the <applet></applet> tags but when I switch over to <object></object> tags I'm not...
7
by: webgreginsf | last post by:
Hello, I tried the following post a few weeks ago and never received any replies, so I figured I'd try again. I'm seeking suggestions for an interesting problem I have. I'm building a web...
2
by: mhust6 | last post by:
I am trying to call a java method from within my Javascript, but cannot seem to get it to work. All the examples I have found online and in the forums are using Java applets. I have a method that...
8
by: mfabricius | last post by:
Hi, I am probably trying to do something really stupid. There is a class shape: class Shape { public: Shape();
11
by: BigZero | last post by:
Hello, can i call Java method.That is java code from php,here what i m looking for i have class called DB in this class all the DB related things ,like DB connection DB insert,DB read etc...
1
by: ajuvendra | last post by:
I have a requirement to run flash file from java application so that it can be used any where as a runnable jar file. Also this should be in pure Java (for example should not have to use a Windows...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.