HTML to PDF with formatting options

P

param

Hi

I am converting a HTML file to PDF. I have specified all the styles &
formatting in separate style sheets, whose paths are given in HTML
document itself.

But when I convert HTML file to PDF document, none of the styles,
colors etc appear in my PDF document. Does anybody has idea about the
same that how to get all the formatting options in PDF?

Thanks & Regards,
Param
 
A

Andrew Thompson

param wrote:
....
I am converting a HTML file to PDF.

Why? PDF's are generally only good for printing, and..
..I have specified all the styles &
formatting in separate style sheets, whose paths are given in HTML
document itself.

...that* can be achieved using HTML with a media='print'
stylesheet attached.

* Most of what could be achieved in formatting a
programmatically generated document.

Andrew T.
 
D

Dag Sunde

Andrew said:
param wrote:
...

Why? PDF's are generally only good for printing, and..


..that* can be achieved using HTML with a media='print'
stylesheet attached.

* Most of what could be achieved in formatting a
programmatically generated document.

There *are* scenarios when you have a nice printable html,
but *still* want to store it as a pdf.

We have a WebApp where the daily report are printed from the
browser with a media='print' stylesheet, but every night that
page is converted to .pdf and archived.

This way, the users can look up old reports and, just as important,
they kan download and store the reports locally.
 
P

param

Dag said:
There *are* scenarios when you have a nice printable html,
but *still* want to store it as a pdf.

We have a WebApp where the daily report are printed from the
browser with a media='print' stylesheet, but every night that
page is converted to .pdf and archived.

This way, the users can look up old reports and, just as important,
they kan download and store the reports locally.

Firstly I am converting HTML object to corresponding XML file & then
this XML file is converted to FO:XSL file. Using FOP I convert this XSL

file into PDF using Tranformer.

I am using FOP alongwith jstl, xerces & avalon.


I have used extrenal stylesheets in my JSP file. I have tried using
inline styles also. Only BOLD text is shown as bold in PDF, rest of the

formatting like table borders, colors, underline etc does not appear in

my PDF document.
 
A

Andrew Thompson

Dag said:
....
There *are* scenarios when you have a nice printable html,
but *still* want to store it as a pdf.

<sceptical>
Yeah? Like when?
We have a WebApp where the daily report are printed from the
browser with a media='print' stylesheet, but every night that
page is converted to .pdf and archived.

'archived'? How?
This way, the users can look up old reports and, just as important,
they kan download and store the reports locally.

But HTML can be 'archived', in the sense of being stored,
and retrieved later, locally or ..elsewhere depending on need.
(My OSComponent offers 'File|Save As' for web pages
(usually complete with stylesheets - though not sure
how that works with print stylesheets - and I am sure
many major user agents offer the same or similar).

Again - I fail to see the thing(s) that can be done
with PDF that cannot be achieved with 'plain old'
HTML/CSS (at least - with a little education of the
end user).

Andrew T.
 
A

Andrew Thompson

param wrote:
.....
I have used extrenal stylesheets in my JSP file.

Did you by any chance try..
a) validating the HTML that resulted from that JSP
<http://validator.w3.org/>
b) validating the external stylesheets
<http://jigsaw.w3.org/css-validator/>
c) attaching an appropriate print stylesheet to the HTML.
d) printing it?
....I have tried using
inline styles also. Only BOLD text is shown as bold in PDF, rest of the

formatting like table borders, colors, underline etc does not appear in

my PDF document.

BTW - besides all the stuff you have 'tried',
I am still not clear 'what you are trying to achieve'
(and 'make PDF' is mereley a strategy, not an
end goal, in this sense) by making a PDF.

Why PDF? What is the purpose of producing these
(horrid) documents?

Andrew T.
 
D

Dag Sunde

Andrew said:
<sceptical>
Yeah? Like when?


'archived'? How?

Stored on the web-server, accessible by the users
But HTML can be 'archived', in the sense of being stored,
and retrieved later, locally or ..elsewhere depending on need.
(My OSComponent offers 'File|Save As' for web pages
(usually complete with stylesheets - though not sure
how that works with print stylesheets - and I am sure
many major user agents offer the same or similar).

Now, *that* is a mess!
Again - I fail to see the thing(s) that can be done
with PDF that cannot be achieved with 'plain old'
HTML/CSS (at least - with a little education of the
end user).

"...with a little education of the end user."

I see volumes of trouble with that path, since most user-agents
(browsers) do this "Save AS..." in vastly different ways.

And another thing is, that a pdf document are for all practical
purposes a read-only document, so its perfect for ie. official
market reports, et.c.

I know you don't like pdf Andrew, but it have its uses. And the OP
had a practical problem generating one. It is always valuable to
inform about alternative solutions, but...

:)
 
C

Chris Uppal

Andrew said:
Again - I fail to see the thing(s) that can be done
with PDF that cannot be achieved with 'plain old'
HTML/CSS (at least - with a little education of the
end user).

HTML is /lousy/ way of representing formatted text. Uncotrollable,
browser-dependent, limited... Just horrible.

I does have its place, I quite agree, but that place is the Web, /not/ my
filesystems, thank you very much!

(I am, of course, overstating. A more rational evaluation would be something
like: HTML is useful when cross-linking is important, and layout and formatting
are not. PDF is useful in the reverse situation. But most worthwhile
documents, IMO, fall into the latter camp.)

-- chris
 
A

Andrew Thompson

Chris said:
HTML is /lousy/ way of representing formatted text. Uncotrollable,
browser-dependent,

I prefer to think of it as 'user enabled'.

If that lovely PDF uses such faint contrast between
text and background that it is illegible - the user is
stuffed.

OTOH - Any half decent UA will allow an end user to
override the author's 'dezigner' colors and provide instead
- high contrast colors (useful for their color blindness)
...and with..
- text at twice normal size (to assist with that
carpal tunnel syndrome - ?).
...limited...

Yes, the PDF is very limited, when you think of it like that.. *
... Just horrible.

There, there. I'll zip some HTML and send it
to you forthwith. * ;-)

Andrew T.
 
P

param

Guys,

My problem is left in between the discussion of HTML & PDF:-(.

If anyone has any idea regarding how to convert html to PDF with all
formatting using fop, please reply.

Regards,
Param
 
A

Andrew Thompson

param said:

Please refraqine from top-posting.
My problem is left in between the discussion of HTML & PDF:-(.

Rubbish! There are a number of questions open on this
thread - all of which you have chosen to ignore.
If anyone has any idea regarding how to convert html to PDF with all
formatting using fop, please reply.

Perhaps *you* could progress the technical problem by
*answering* the questions I have asked you, rather than
just treating this like a help desk that answers *your*
questions. :-/

Andrew T.
 
P

param

Andrew said:
Please refraqine from top-posting.


Rubbish! There are a number of questions open on this
thread - all of which you have chosen to ignore.


Perhaps *you* could progress the technical problem by
*answering* the questions I have asked you, rather than
just treating this like a help desk that answers *your*
questions. :-/

Andrew T.

Hi Andrew,

I am really sorry if I offended you in anyways. Thanks alot for all the
help.

Regards,
Param
 
A

Andrew Thompson

param wrote:
.....
I am really sorry if I offended you in anyways.

You have not offended me - people that *try* to
offend me usually fail.
...Thanks alot for all the help.

Whoa up! We have, as you pointed out, gone off into a
little side-track discussing the benefits of HTML over PDF.

Well, it's partly a side-track, and partly a legitimate
*question* which has still not been answered. Perhaps,
if you answer the simple questions above, we can
a) establish that a PDF (ick) is actually *required* here
(yes, yes - you keep saying - but please provide us with
a few words to *convince* us.)
b) (which might then encourage) those who actually
*know* how to resolve the issue of producing a PDF
(ick) to break into the thread - they seem to be shy
creatures, and need some encouragement.

( And as an aside - I am hoping you resolve the
technical issue, whichever way it goes.. )

Andrew T.
 
P

param

Andrew said:
param wrote:
....

You have not offended me - people that *try* to
offend me usually fail.


Whoa up! We have, as you pointed out, gone off into a
little side-track discussing the benefits of HTML over PDF.

Well, it's partly a side-track, and partly a legitimate
*question* which has still not been answered. Perhaps,
if you answer the simple questions above, we can
a) establish that a PDF (ick) is actually *required* here
(yes, yes - you keep saying - but please provide us with
a few words to *convince* us.)
b) (which might then encourage) those who actually
*know* how to resolve the issue of producing a PDF
(ick) to break into the thread - they seem to be shy
creatures, and need some encouragement.

( And as an aside - I am hoping you resolve the
technical issue, whichever way it goes.. )

Andrew T.

I am trying to solve the issue. Not solved yet :(.

Regarding PDF & HTML debate, I must say both have their own advantages.
Its just the matter of place where they are used.

Param
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,270
Messages
2,571,102
Members
48,773
Latest member
Kaybee

Latest Threads

Top