Re: Your input on new open source projects
Re: Your input on new open source projects
- Subject: Re: Your input on new open source projects
- From: Hugi Thordarson <email@hidden>
- Date: Wed, 22 Aug 2007 17:44:52 +0000
If you don't mind using commercial software, I'm using PD4ML to do
this and it works like a charm (I gave up using iText, primarily
because I didn't have the time to figure out some of it's quirks -
although I'm using it in some places).
I grabbed the following method from our frameworks as an example.
But of course I'd love an open source alternative :-).
Cheers,
- Hugi
/**
* Uses PD4ML to generate a PDF-file from HTML.
*
* @param htmlString The HTML to work from.
* @param isLandscape
* @return Rendered PDF-data.
*/
public static NSData convertHTMLToPdf( String htmlString, boolean
isLandscape ) {
java.awt.Dimension format = PD4Constants.A4;
boolean landscapeValue = isLandscape;
int topValue = 10;
int leftValue = 10;
int rightValue = 10;
int bottomValue = 10;
String unitsValue = "mm";
boolean patchValue = true;
boolean splitValue = true;
String proxyHost = "";
int proxyPort = 0;
int userSpaceWidth = 780;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
if ( proxyHost != null && proxyHost.length() != 0 && proxyPort !=
0 ) {
System.getProperties().setProperty("proxySet", "true");
System.getProperties().setProperty("proxyHost", proxyHost);
System.getProperties().setProperty("proxyPort", "" + proxyPort);
}
PD4ML pd4ml = new PD4ML();
if( landscapeValue ) {
format = pd4ml.changePageOrientation( format );
}
pd4ml.setPageSize( format );
if( unitsValue.equals( "mm" ) ) {
pd4ml.setPageInsetsMM( new java.awt.Insets(topValue, leftValue,
bottomValue, rightValue) );
} else {
pd4ml.setPageInsets( new java.awt.Insets(topValue, leftValue,
bottomValue, rightValue) );
}
pd4ml.setHtmlWidth( userSpaceWidth );
pd4ml.enableImgSplit( splitValue );
pd4ml.render( new StringReader( htmlString ), bos );
}
catch (Exception e) {
e.printStackTrace();
}
return new NSData( bos.toByteArray() );
}
On 22.8.2007, at 07:28, Fabrice Pipart wrote:
On Aug 20, 2007, at 11:44 AM, Kieran Kelleher wrote:
Hi Pascal,
#1) An open source WO framework that renders PDF files from a HTML
response the same as if a user did a "Print to PDF" in their
browser ..... the framework can wrap iText or whatever .....
That one would be GREAT for me :-)
#2) The OpenOffice.org utility framework that is on your list
Thanks, Kieran
On Aug 19, 2007, at 9:33 PM, Pascal Robert wrote:
- a framework using OpenOffice.org to do document conversion,
opening and writing Word, Excel and PowerPoint documents, etc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40easyshadow.com
This email sent to email@hidden
www.easyshadow.com
EasyMediaOnline
Digital Signage Software
Easyshadow
Palais de la Scala
1 avenue Henri Dunant
Suite 1155
MC - 98000 Monaco
Skype: fabrice.pipart
Tel. +377 97 98 21 04 (direct)
Fax. +377 97 70 88 07
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden