Thread: [css2xslfo-support] Command line for creating pdf
Brought to you by:
wdonne
From: Aaron S. <aar...@gm...> - 2010-09-07 19:36:57
|
The only example I've seen of running css2xslfo with fop is: java -jar css2fopnew.jar url_or_filename <options> So based on that I placed AppViewer.htm in the same directory and ran this: java -jar css2fopnew1_6_2 .jar AppViewer.htm And it gave an error indicating no output file specified. I then tried this: java -jar css2fopnew1_6_2.jar AppViewer.htm -pdf Test.pdf and it does nothing but print the help for the command line with no errors. So I am not understanding something here. I want to produce a pdf for the given html file(which is xhtml compliant, is that the same as being xhtml?). My hope was that this command would produce a pdf file. Can anyone advise me what I'm doing wrong? Here are details/versions for anyone that wants this information: Long story is that I'm essentially trying to piece together a way for a server side asp.net app to call this command line and produce a PDF version of the page to serve to a user for printing. I want the PDF to appear as close as possible to how it appears in a browser. I would also like a css file to be used as well for styling(but does not replace the user agent CSS). The html file contains a tag with: link rel="Stylesheet" type="text/css" href="UacApplicationControls.css" and the css file is in the same directory as the htm file. Will css2fop use this tag and apply the styles from that CSS file? I saw some documentation showing the correct syntax that it recognizes for a stylesheet link, but now that I am trying to verify I cannot find it. I actually just dropped the css2xslfo jar files, and the fop jar file into fop's library directory. So that all jar's are in the same directory, and the htm and css files are as well. This way I didn't have to muck with an environment settings for now since I'm just testing to see if this tool is a viable solution. It seems to be finding everything just find. I am on Windows XP, installed the JRE 6 update 21, and using FOP 1.0. ______________ Aaron Shumaker Cell: (850) 566-0181 Aar...@gm... "I object to doing things that computers can do." -Olin Shivers |
From: Aaron S. <aar...@gm...> - 2010-09-07 19:59:28
|
(Sorry if this is a dupe, when I sent it the first time I had not joined the mailing list yet, so I was not sure if the mailing list would block mail from non-subscribers.) The only example I've seen of running css2xslfo with fop is: java -jar css2fopnew.jar url_or_filename <options> So based on that I placed AppViewer.htm in the same directory and ran this: java -jar css2fopnew1_6_2 .jar AppViewer.htm And it gave an error indicating no output file specified. I then tried this: java -jar css2fopnew1_6_2.jar AppViewer.htm -pdf Test.pdf and it does nothing but print the help for the command line with no errors. So I am not understanding something here. I want to produce a pdf for the given html file(which is xhtml compliant, is that the same as being xhtml?). My hope was that this command would produce a pdf file. Can anyone advise me what I'm doing wrong? Thanks in advance. Here are details/versions for anyone that wants this information: Long story is that I'm essentially trying to piece together a way for a server side asp.net app to call this command line and produce a PDF version of the page to serve to a user for printing. I want the PDF to appear as close as possible to how it appears in a browser. I would also like a css file to be used as well for styling(but does not replace the user agent CSS). The html file contains a tag with: link rel="Stylesheet" type="text/css" href="UacApplicationControls.css" and the css file is in the same directory as the htm file. Will css2fop use this tag and apply the styles from that CSS file? I saw some documentation showing the correct syntax that it recognizes for a stylesheet link, but now that I am trying to verify I cannot find it. I actually just dropped the css2xslfo jar files, and the fop jar file into fop's library directory. So that all jar's are in the same directory, and the htm and css files are as well. This way I didn't have to muck with an environment settings for now since I'm just testing to see if this tool is a viable solution. It seems to be finding everything just find. I am on Windows XP, installed the JRE 6 update 21, and using FOP 1.0. |
From: Peter W. <wms...@gm...> - 2010-09-07 20:20:35
|
Hi Aaron, This sounds like something similar that I worked on a couple of years ago (having a Perl script on a Unix server run CLI commands to convert a web page into a PDF). What I used was: css2xslfo1_5_2.jar <input filename> -fo <output fo file> fop <input fo file> <output pdf> I think I tried css2fopnew1_5_1.jar to output directly to PDF, but it wouldn't convert everything the way I wanted it to. Things might have changed a bit since then too. I know I did get this working with the two commands above, and it converted XHTML and inline CSS (not sure about linking the CSS file). Good luck, Peter On 07-Sep-10 3:59 PM, Aaron Shumaker wrote: > (Sorry if this is a dupe, when I sent it the first time I had not > joined the mailing list yet, so I was not sure if the mailing list > would block mail from non-subscribers.) > > The only example I've seen of running css2xslfo with fop is: > > java -jar css2fopnew.jar url_or_filename<options> > > So based on that I placed AppViewer.htm in the same directory and ran this: > > java -jar css2fopnew1_6_2 .jar AppViewer.htm > > And it gave an error indicating no output file specified. I then tried this: > > java -jar css2fopnew1_6_2.jar AppViewer.htm -pdf Test.pdf > > and it does nothing but print the help for the command line with no > errors. So I am not understanding something here. I want to produce > a pdf for the given html file(which is xhtml compliant, is that the > same as being xhtml?). > > My hope was that this command would produce a pdf file. Can anyone > advise me what I'm doing wrong? > > Thanks in advance. > > Here are details/versions for anyone that wants this information: > Long story is that I'm essentially trying to piece together a way for > a server side asp.net app to call this command line and produce a PDF > version of the page to serve to a user for printing. I want the PDF > to appear as close as possible to how it appears in a browser. > > I would also like a css file to be used as well for styling(but does > not replace the user agent CSS). The html file contains a tag with: > link rel="Stylesheet" type="text/css" href="UacApplicationControls.css" > > and the css file is in the same directory as the htm file. Will > css2fop use this tag and apply the styles from that CSS file? I saw > some documentation showing the correct syntax that it recognizes for a > stylesheet link, but now that I am trying to verify I cannot find it. > > I actually just dropped the css2xslfo jar files, and the fop jar file > into fop's library directory. So that all jar's are in the same > directory, and the htm and css files are as well. This way I didn't > have to muck with an environment settings for now since I'm just > testing to see if this tool is a viable solution. It seems to be > finding everything just find. > > I am on Windows XP, installed the JRE 6 update 21, and using FOP 1.0. > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > css2xslfo-support mailing list > css...@li... > https://lists.sourceforge.net/lists/listinfo/css2xslfo-support > |
From: Aaron S. <aar...@gm...> - 2010-09-07 23:02:55
|
Thanks, running the separate commands is working. Only problem is I don't specify widths for any of my table cells, such that they resize to fit contents, and this looks very nice in the browser, but the resulting PDF looks really bad. I assume this is the meaning of the table-layout="auto" not supported warning from FOP. So I am experimenting with setting pixel widths on the columns, but the spacing in the browser versus the PDF is still quite different but somewhat better. Is this just the nature of the beast and the best I can expect? -Aaron On Tue, Sep 7, 2010 at 4:20 PM, Peter Williams <wms...@gm...> wrote: > Hi Aaron, > This sounds like something similar that I worked on a couple of years ago > (having a Perl script on a Unix server run CLI commands to convert a web > page into a PDF). What I used was: > > css2xslfo1_5_2.jar <input filename> -fo <output fo file> > > fop <input fo file> <output pdf> > > I think I tried css2fopnew1_5_1.jar to output directly to PDF, but it > wouldn't convert everything the way I wanted it to. Things might have > changed a bit since then too. I know I did get this working with the two > commands above, and it converted XHTML and inline CSS (not sure about > linking the CSS file). > > Good luck, > Peter > |
From: Peter W. <wms...@gm...> - 2010-09-08 00:39:15
|
I didn't do a whole lot with tables, so I can't offer much advice. I do have in my notes, that after generating the .fo file I would switch out the table-layout="auto" for: table-layout="fixed" width="100%" Peter On 07-Sep-10 6:40 PM, Aaron Shumaker wrote: > Thanks, running the separate commands is working. Only problem is I > don't specify widths for any of my table cells, such that they resize > to fit contents, and this looks very nice in the browser, but the > resulting PDF looks really bad. I assume this is the meaning of the > table-layout="auto" not supported warning from FOP. > > So I am experimenting with setting pixel widths on the columns, but > the spacing in the browser versus the PDF is still quite different but > somewhat better. Is this just the nature of the beast and the best I > can expect? > > -Aaron |
From: Brad C. <bk...@mu...> - 2010-09-08 00:52:33
|
I suggest you use PCW or percentage widths rather than px <col width="2*" /> or <col width="15%" /> for example. Perhaps you didn't literally mean <col width="55px" /> On 09/07/2010 06:40 PM, Aaron Shumaker wrote: > Thanks, running the separate commands is working. Only problem is I > don't specify widths for any of my table cells, such that they resize > to fit contents, and this looks very nice in the browser, but the > resulting PDF looks really bad. I assume this is the meaning of the > table-layout="auto" not supported warning from FOP. > > So I am experimenting with setting pixel widths on the columns, but > the spacing in the browser versus the PDF is still quite different but > somewhat better. Is this just the nature of the beast and the best I > can expect? > > -Aaron > > > > > > On Tue, Sep 7, 2010 at 4:20 PM, Peter Williams<wms...@gm...> wrote: > >> Hi Aaron, >> This sounds like something similar that I worked on a couple of years ago >> (having a Perl script on a Unix server run CLI commands to convert a web >> page into a PDF). What I used was: >> >> css2xslfo1_5_2.jar<input filename> -fo<output fo file> >> >> fop<input fo file> <output pdf> >> >> I think I tried css2fopnew1_5_1.jar to output directly to PDF, but it >> wouldn't convert everything the way I wanted it to. Things might have >> changed a bit since then too. I know I did get this working with the two >> commands above, and it converted XHTML and inline CSS (not sure about >> linking the CSS file). >> >> Good luck, >> Peter >> >> > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > css2xslfo-support mailing list > css...@li... > https://lists.sourceforge.net/lists/listinfo/css2xslfo-support > -- Brad Clements, bk...@mu... (315)268-1000 http://www.murkworks.com AOL-IM: BKClements |
From: Werner D. <wer...@pi...> - 2010-09-08 07:36:35
|
Hi Aaron, The correct command-line is: java -jar css2fopnew.jar AppViewer.htm -fop -pdf AppViewer.pdf After the "-fop" you can use all of FOP's options. Best regards, Werner. On 07 Sep 2010, at 21:59, Aaron Shumaker wrote: > (Sorry if this is a dupe, when I sent it the first time I had not > joined the mailing list yet, so I was not sure if the mailing list > would block mail from non-subscribers.) > > The only example I've seen of running css2xslfo with fop is: > > java -jar css2fopnew.jar url_or_filename <options> > > So based on that I placed AppViewer.htm in the same directory and ran this: > > java -jar css2fopnew1_6_2 .jar AppViewer.htm > > And it gave an error indicating no output file specified. I then tried this: > > java -jar css2fopnew1_6_2.jar AppViewer.htm -pdf Test.pdf > > and it does nothing but print the help for the command line with no > errors. So I am not understanding something here. I want to produce > a pdf for the given html file(which is xhtml compliant, is that the > same as being xhtml?). > > My hope was that this command would produce a pdf file. Can anyone > advise me what I'm doing wrong? > > Thanks in advance. > > Here are details/versions for anyone that wants this information: > Long story is that I'm essentially trying to piece together a way for > a server side asp.net app to call this command line and produce a PDF > version of the page to serve to a user for printing. I want the PDF > to appear as close as possible to how it appears in a browser. > > I would also like a css file to be used as well for styling(but does > not replace the user agent CSS). The html file contains a tag with: > link rel="Stylesheet" type="text/css" href="UacApplicationControls.css" > > and the css file is in the same directory as the htm file. Will > css2fop use this tag and apply the styles from that CSS file? I saw > some documentation showing the correct syntax that it recognizes for a > stylesheet link, but now that I am trying to verify I cannot find it. > > I actually just dropped the css2xslfo jar files, and the fop jar file > into fop's library directory. So that all jar's are in the same > directory, and the htm and css files are as well. This way I didn't > have to muck with an environment settings for now since I'm just > testing to see if this tool is a viable solution. It seems to be > finding everything just find. > > I am on Windows XP, installed the JRE 6 update 21, and using FOP 1.0. > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > css2xslfo-support mailing list > css...@li... > https://lists.sourceforge.net/lists/listinfo/css2xslfo-support -- http://www.pincette.biz/ Handling your documents with care, wherever you are. |
From: Aaron S. <aar...@gm...> - 2010-09-08 13:55:44
|
Thanks Werner, that is working for me. On Wed, Sep 8, 2010 at 3:08 AM, Werner Donné <wer...@pi...> wrote: > Hi Aaron, > > The correct command-line is: > > java -jar css2fopnew.jar AppViewer.htm -fop -pdf AppViewer.pdf > > After the "-fop" you can use all of FOP's options. > > Best regards, > > Werner. > > On 07 Sep 2010, at 21:59, Aaron Shumaker wrote: > >> (Sorry if this is a dupe, when I sent it the first time I had not >> joined the mailing list yet, so I was not sure if the mailing list >> would block mail from non-subscribers.) >> >> The only example I've seen of running css2xslfo with fop is: >> >> java -jar css2fopnew.jar url_or_filename <options> >> >> So based on that I placed AppViewer.htm in the same directory and ran this: >> >> java -jar css2fopnew1_6_2 .jar AppViewer.htm >> >> And it gave an error indicating no output file specified. I then tried this: >> >> java -jar css2fopnew1_6_2.jar AppViewer.htm -pdf Test.pdf >> >> and it does nothing but print the help for the command line with no >> errors. So I am not understanding something here. I want to produce >> a pdf for the given html file(which is xhtml compliant, is that the >> same as being xhtml?). >> >> My hope was that this command would produce a pdf file. Can anyone >> advise me what I'm doing wrong? >> >> Thanks in advance. >> >> Here are details/versions for anyone that wants this information: >> Long story is that I'm essentially trying to piece together a way for >> a server side asp.net app to call this command line and produce a PDF >> version of the page to serve to a user for printing. I want the PDF >> to appear as close as possible to how it appears in a browser. >> >> I would also like a css file to be used as well for styling(but does >> not replace the user agent CSS). The html file contains a tag with: >> link rel="Stylesheet" type="text/css" href="UacApplicationControls.css" >> >> and the css file is in the same directory as the htm file. Will >> css2fop use this tag and apply the styles from that CSS file? I saw >> some documentation showing the correct syntax that it recognizes for a >> stylesheet link, but now that I am trying to verify I cannot find it. >> >> I actually just dropped the css2xslfo jar files, and the fop jar file >> into fop's library directory. So that all jar's are in the same >> directory, and the htm and css files are as well. This way I didn't >> have to muck with an environment settings for now since I'm just >> testing to see if this tool is a viable solution. It seems to be >> finding everything just find. >> >> I am on Windows XP, installed the JRE 6 update 21, and using FOP 1.0. >> >> ------------------------------------------------------------------------------ >> This SF.net Dev2Dev email is sponsored by: >> >> Show off your parallel programming skills. >> Enter the Intel(R) Threading Challenge 2010. >> http://p.sf.net/sfu/intel-thread-sfd >> _______________________________________________ >> css2xslfo-support mailing list >> css...@li... >> https://lists.sourceforge.net/lists/listinfo/css2xslfo-support > > -- > http://www.pincette.biz/ > Handling your documents with care, wherever you are. > > |