Re: Including Fonts into PDF using ERPDFGeneration

2014-01-30 Thread Johann Werner
Hi Christoph,

that’s how I create a PDF using ERPDFGeneration with custom fonts:

PDFTemplate pdfPage = pageWithName(PDFTemplate.class);
NSMutableDictionary config = new NSMutableDictionary();
config.takeValueForKey(new NSArray("Fonts/MyFont.ttf“, 
"Fonts/MyOtherFont.ttf"), "fonts");
NSData pdf = 
ERPDFUtilities.htmlAsPdf(pdfPage.generateResponse().contentString(), 
CharEncoding.UTF_8, null, config);

In this example the fonts are located in a directory „Fonts“ within „Resources“.

jw


Am 30.01.2014 um 13:13 schrieb Christoph Wick :

> Hi List,
> 
> I try to include fonts into a PDF document using ERPDFGeneration. The 
> documentation of ERPFDWrapper tells me that there is a binding called 
> "fonts". The binding is described as "(optional) array of font filenames to 
> include for PDF generation".
> 
> OK so far. But whatever I set the "fonts" bindings to, I get an 
> ClassCastException that a String cannot be casted to NSArray. 
> Stacktrace below.
> 
> I've looked into the code and I found line 120 in FlyingSaucerImpl.java:
> 
>   NSArray fonts = (NSArray) 
> configuration.objectForKey("fonts"); 
> 
> So, what's the correct syntax of the bindings value string to be converted 
> into an NSArray of Strings? I've tried ['Font 1', 'Font2'] as well as {'Font 
> 1', 'Font2'}, but that all doesn't work.
> 
> Thx,
> C.U.CW
> 
> 
> Stacktrace:
> 
> Error:java.lang.ClassCastException: java.lang.String cannot be cast 
> to com.webobjects.foundation.NSArray
> Reason:   java.lang.String cannot be cast to 
> com.webobjects.foundation.NSArray
> Stack trace:  
> File  Line#   Method  Package
> FlyingSaucerImpl.java 120 fontsFromConfiguration  er.pdf.builder
> FlyingSaucerImpl.java 91  setSource   er.pdf.builder
> ERPDFUtilities.java   132 htmlAsPdf   er.pdf
> ERPDFWrapper.java 89  responseAsPdf   er.pdf
> ERPDFWrapper.java 66  appendToResponseer.pdf
> WOComponent.java  1122appendToResponsecom.webobjects.appserver
> ERXComponent.java 195 appendToResponseer.extensions.components
> WOSession.java1385appendToResponsecom.webobjects.appserver
> WOApplication.java1794appendToResponsecom.webobjects.appserver
> ERXApplication.java   2005appendToResponseer.extensions.appserver
> ERXComponentRequestHandler.java   190 _dispatchWithPreparedPage   
> er.extensions.appserver
> ERXComponentRequestHandler.java   235 _dispatchWithPreparedSession
> er.extensions.appserver
> ERXComponentRequestHandler.java   268 
> _dispatchWithPreparedApplicationer.extensions.appserver
> ERXComponentRequestHandler.java   302 _handleRequest  
> er.extensions.appserver
> ERXComponentRequestHandler.java   378 handleRequest   
> er.extensions.appserver
> WOApplication.java1687dispatchRequest com.webobjects.appserver
> ERXApplication.java   2109dispatchRequestImmediately  
> er.extensions.appserver
> ERXApplication.java   2074dispatchRequest er.extensions.appserver
> WOWorkerThread.java   144 runOnce com.webobjects.appserver._private
> WOWorkerThread.java   226 run com.webobjects.appserver._private
> Thread.java   722 run java.lang
> 
> 
> -- 
> Christoph Wick - Diplom Informatiker, Managing Director
> i4innovation GmbH, Professor-Neu-Allee 39, 53225 Bonn, Germany
> 
> T +49 2 28 28 62 97 93
> M +49 1 51 22 65 78 90
> F +49 2 28 28 62 97 99
> M c...@i4innovation.de
> W www.i4innovation.de
> Skype: christoph_wick
> 
> Geschäftsführer: Thomas Heep, Christoph Wick
> Sitz der Gesellschaft: Bonn | Amtsgericht Bonn HRB 18548 | USt-IdNr.: 
> DE276502600
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/jw%40oyosys.com
> 
> This email sent to j...@oyosys.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Including Fonts into PDF using ERPDFGeneration

2014-01-30 Thread Theodore Petrosky
actually the font name would be something like   Arial.ttf or Helvetica.ttf  

the docs do say 'filename'.



On Jan 30, 2014, at 7:38 AM, Theodore Petrosky  wrote:

> the docs say:
> 
> (optional) array of font filenames to include for PDF generation
> 
> It doesn't say a dictionary.
> 
> NSArray fontsArray = NSArray("Arial", "Helvetica");
> 
> Is how I would do it according to the documentation. Of course, I generally 
> just use JasperReports and convert fonts to .jar files and put them in the 
> build path.Then I don't have to worry.
> 
> Ted
> 
> On Jan 30, 2014, at 7:13 AM, Christoph Wick  wrote:
> 
>> Hi List,
>> 
>> I try to include fonts into a PDF document using ERPDFGeneration. The 
>> documentation of ERPFDWrapper tells me that there is a binding called 
>> "fonts". The binding is described as "(optional) array of font filenames to 
>> include for PDF generation".
>> 
>> OK so far. But whatever I set the "fonts" bindings to, I get an 
>> ClassCastException that a String cannot be casted to NSArray. 
>> Stacktrace below.
>> 
>> I've looked into the code and I found line 120 in FlyingSaucerImpl.java:
>> 
>>  NSArray fonts = (NSArray) 
>> configuration.objectForKey("fonts"); 
>> 
>> So, what's the correct syntax of the bindings value string to be converted 
>> into an NSArray of Strings? I've tried ['Font 1', 'Font2'] as well as {'Font 
>> 1', 'Font2'}, but that all doesn't work.
>> 
>> Thx,
>> C.U.CW
>> 
>> 
>> Stacktrace:
>> 
>> Error:   java.lang.ClassCastException: java.lang.String cannot be cast 
>> to com.webobjects.foundation.NSArray
>> Reason:  java.lang.String cannot be cast to 
>> com.webobjects.foundation.NSArray
>> Stack trace: 
>> File Line#   Method  Package
>> FlyingSaucerImpl.java120 fontsFromConfiguration  er.pdf.builder
>> FlyingSaucerImpl.java91  setSource   er.pdf.builder
>> ERPDFUtilities.java  132 htmlAsPdf   er.pdf
>> ERPDFWrapper.java89  responseAsPdf   er.pdf
>> ERPDFWrapper.java66  appendToResponseer.pdf
>> WOComponent.java 1122appendToResponsecom.webobjects.appserver
>> ERXComponent.java195 appendToResponseer.extensions.components
>> WOSession.java   1385appendToResponsecom.webobjects.appserver
>> WOApplication.java   1794appendToResponsecom.webobjects.appserver
>> ERXApplication.java  2005appendToResponseer.extensions.appserver
>> ERXComponentRequestHandler.java  190 _dispatchWithPreparedPage   
>> er.extensions.appserver
>> ERXComponentRequestHandler.java  235 _dispatchWithPreparedSession
>> er.extensions.appserver
>> ERXComponentRequestHandler.java  268 
>> _dispatchWithPreparedApplicationer.extensions.appserver
>> ERXComponentRequestHandler.java  302 _handleRequest  
>> er.extensions.appserver
>> ERXComponentRequestHandler.java  378 handleRequest   
>> er.extensions.appserver
>> WOApplication.java   1687dispatchRequest com.webobjects.appserver
>> ERXApplication.java  2109dispatchRequestImmediately  
>> er.extensions.appserver
>> ERXApplication.java  2074dispatchRequest er.extensions.appserver
>> WOWorkerThread.java  144 runOnce com.webobjects.appserver._private
>> WOWorkerThread.java  226 run com.webobjects.appserver._private
>> Thread.java  722 run java.lang
>> 
>> 
>> -- 
>> Christoph Wick - Diplom Informatiker, Managing Director
>> i4innovation GmbH, Professor-Neu-Allee 39, 53225 Bonn, Germany
>> 
>> T +49 2 28 28 62 97 93
>> M +49 1 51 22 65 78 90
>> F +49 2 28 28 62 97 99
>> M c...@i4innovation.de
>> W www.i4innovation.de
>> Skype: christoph_wick
>> 
>> Geschäftsführer: Thomas Heep, Christoph Wick
>> Sitz der Gesellschaft: Bonn | Amtsgericht Bonn HRB 18548 | USt-IdNr.: 
>> DE276502600
>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
>> 
>> This email sent to tedp...@yahoo.com
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
> 
> This email sent to tedp...@yahoo.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Including Fonts into PDF using ERPDFGeneration

2014-01-30 Thread Theodore Petrosky
the docs say:

(optional) array of font filenames to include for PDF generation

It doesn't say a dictionary.

NSArray fontsArray = NSArray("Arial", "Helvetica");

Is how I would do it according to the documentation. Of course, I generally 
just use JasperReports and convert fonts to .jar files and put them in the 
build path.Then I don't have to worry.

Ted

On Jan 30, 2014, at 7:13 AM, Christoph Wick  wrote:

> Hi List,
> 
> I try to include fonts into a PDF document using ERPDFGeneration. The 
> documentation of ERPFDWrapper tells me that there is a binding called 
> "fonts". The binding is described as "(optional) array of font filenames to 
> include for PDF generation".
> 
> OK so far. But whatever I set the "fonts" bindings to, I get an 
> ClassCastException that a String cannot be casted to NSArray. 
> Stacktrace below.
> 
> I've looked into the code and I found line 120 in FlyingSaucerImpl.java:
> 
>   NSArray fonts = (NSArray) 
> configuration.objectForKey("fonts"); 
> 
> So, what's the correct syntax of the bindings value string to be converted 
> into an NSArray of Strings? I've tried ['Font 1', 'Font2'] as well as {'Font 
> 1', 'Font2'}, but that all doesn't work.
> 
> Thx,
> C.U.CW
> 
> 
> Stacktrace:
> 
> Error:java.lang.ClassCastException: java.lang.String cannot be cast 
> to com.webobjects.foundation.NSArray
> Reason:   java.lang.String cannot be cast to 
> com.webobjects.foundation.NSArray
> Stack trace:  
> File  Line#   Method  Package
> FlyingSaucerImpl.java 120 fontsFromConfiguration  er.pdf.builder
> FlyingSaucerImpl.java 91  setSource   er.pdf.builder
> ERPDFUtilities.java   132 htmlAsPdf   er.pdf
> ERPDFWrapper.java 89  responseAsPdf   er.pdf
> ERPDFWrapper.java 66  appendToResponseer.pdf
> WOComponent.java  1122appendToResponsecom.webobjects.appserver
> ERXComponent.java 195 appendToResponseer.extensions.components
> WOSession.java1385appendToResponsecom.webobjects.appserver
> WOApplication.java1794appendToResponsecom.webobjects.appserver
> ERXApplication.java   2005appendToResponseer.extensions.appserver
> ERXComponentRequestHandler.java   190 _dispatchWithPreparedPage   
> er.extensions.appserver
> ERXComponentRequestHandler.java   235 _dispatchWithPreparedSession
> er.extensions.appserver
> ERXComponentRequestHandler.java   268 
> _dispatchWithPreparedApplicationer.extensions.appserver
> ERXComponentRequestHandler.java   302 _handleRequest  
> er.extensions.appserver
> ERXComponentRequestHandler.java   378 handleRequest   
> er.extensions.appserver
> WOApplication.java1687dispatchRequest com.webobjects.appserver
> ERXApplication.java   2109dispatchRequestImmediately  
> er.extensions.appserver
> ERXApplication.java   2074dispatchRequest er.extensions.appserver
> WOWorkerThread.java   144 runOnce com.webobjects.appserver._private
> WOWorkerThread.java   226 run com.webobjects.appserver._private
> Thread.java   722 run java.lang
> 
> 
> -- 
> Christoph Wick - Diplom Informatiker, Managing Director
> i4innovation GmbH, Professor-Neu-Allee 39, 53225 Bonn, Germany
> 
> T +49 2 28 28 62 97 93
> M +49 1 51 22 65 78 90
> F +49 2 28 28 62 97 99
> M c...@i4innovation.de
> W www.i4innovation.de
> Skype: christoph_wick
> 
> Geschäftsführer: Thomas Heep, Christoph Wick
> Sitz der Gesellschaft: Bonn | Amtsgericht Bonn HRB 18548 | USt-IdNr.: 
> DE276502600
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
> 
> This email sent to tedp...@yahoo.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Including Fonts into PDF using ERPDFGeneration

2014-01-30 Thread Christoph Wick
Hi List,

I try to include fonts into a PDF document using ERPDFGeneration. The 
documentation of ERPFDWrapper tells me that there is a binding called "fonts". 
The binding is described as "(optional) array of font filenames to include for 
PDF generation".

OK so far. But whatever I set the "fonts" bindings to, I get an 
ClassCastException that a String cannot be casted to NSArray. 
Stacktrace below.

I've looked into the code and I found line 120 in FlyingSaucerImpl.java:

NSArray fonts = (NSArray) 
configuration.objectForKey("fonts"); 

So, what's the correct syntax of the bindings value string to be converted into 
an NSArray of Strings? I've tried ['Font 1', 'Font2'] as well as {'Font 1', 
'Font2'}, but that all doesn't work.

Thx,
C.U.CW


Stacktrace:

Error:  java.lang.ClassCastException: java.lang.String cannot be cast to 
com.webobjects.foundation.NSArray
Reason: java.lang.String cannot be cast to com.webobjects.foundation.NSArray
Stack trace:
FileLine#   Method  Package
FlyingSaucerImpl.java   120 fontsFromConfiguration  er.pdf.builder
FlyingSaucerImpl.java   91  setSource   er.pdf.builder
ERPDFUtilities.java 132 htmlAsPdf   er.pdf
ERPDFWrapper.java   89  responseAsPdf   er.pdf
ERPDFWrapper.java   66  appendToResponseer.pdf
WOComponent.java1122appendToResponsecom.webobjects.appserver
ERXComponent.java   195 appendToResponseer.extensions.components
WOSession.java  1385appendToResponsecom.webobjects.appserver
WOApplication.java  1794appendToResponsecom.webobjects.appserver
ERXApplication.java 2005appendToResponseer.extensions.appserver
ERXComponentRequestHandler.java 190 _dispatchWithPreparedPage   
er.extensions.appserver
ERXComponentRequestHandler.java 235 _dispatchWithPreparedSession
er.extensions.appserver
ERXComponentRequestHandler.java 268 _dispatchWithPreparedApplication
er.extensions.appserver
ERXComponentRequestHandler.java 302 _handleRequest  er.extensions.appserver
ERXComponentRequestHandler.java 378 handleRequest   er.extensions.appserver
WOApplication.java  1687dispatchRequest com.webobjects.appserver
ERXApplication.java 2109dispatchRequestImmediately  
er.extensions.appserver
ERXApplication.java 2074dispatchRequest er.extensions.appserver
WOWorkerThread.java 144 runOnce com.webobjects.appserver._private
WOWorkerThread.java 226 run com.webobjects.appserver._private
Thread.java 722 run java.lang


-- 
Christoph Wick - Diplom Informatiker, Managing Director
i4innovation GmbH, Professor-Neu-Allee 39, 53225 Bonn, Germany

T +49 2 28 28 62 97 93
M +49 1 51 22 65 78 90
F +49 2 28 28 62 97 99
M c...@i4innovation.de
W www.i4innovation.de
Skype: christoph_wick

Geschäftsführer: Thomas Heep, Christoph Wick
Sitz der Gesellschaft: Bonn | Amtsgericht Bonn HRB 18548 | USt-IdNr.: 
DE276502600


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com