DOH! I knew I forgot something. But there it is:

    protected String addLineNumbers(String in) {
        String out = "";
        int i = 1, beginIndex = 0;
        int endIndex = in.indexOf('\n');
        while (endIndex != -1) {
            out += in.substring(beginIndex, endIndex+1);
            beginIndex = endIndex+1;
            endIndex = in.indexOf('\n', beginIndex);
            // only want to add line numbers if we have a next newline
            if (endIndex != -1) out +=  (i++) + " ";
        }
        return out;
    }

Michael.

On 1/30/12 9:17 PM, Paul Yu wrote:
Michael

Can you sent the addLineNumbers() method as well?

Thanks./

--
Paul Yu
Sent with Sparrow <http://www.sparrowmailapp.com/?sig>

On Monday, January 30, 2012 at 3:52 PM, Michael Hast wrote:

The HTML without the List binding works for me with and without additional bindings. I am passing the font to the PDF report, so that's why I need additional bindings. But even without them, the PDF generates just fine.

ERPDFWrapper : ERPDFWrapper {
    filename = ^pdfReportFilename;
    fonts = fonts;
    framework = "LDRDReport";
}

In our report page we added an appendToResponse to catch any SAXParseExeption and print out the line and column number in addition to the XML input:

public void appendToResponse(WOResponse response, WOContext context) {
        try {
            super.appendToResponse(response, context);
        } catch (Exception ex) {
            if (ex.getCause() instanceof SAXParseException) {
SAXParseException parseException = (SAXParseException)ex.getCause(); String logMessage = "'"+getClass().getName()+"' caused a SAXParseException"; logMessage += "\nMessage: '"+parseException.getMessage()+"'"; // weird but true, getLineNumber is off by 1 (for display purposes I think - mhast) logMessage += "\nLine : "+(parseException.getLineNumber() - 1); logMessage += "\nColumn : "+parseException.getColumnNumber();
                logMessage += "\n--- content begin ---";
                logMessage += addLineNumbers(response.contentString());
                logMessage += "--- content end ---";
                NSLog.err.appendln(logMessage);
throw new NSForwardException(new Exception("PDFReportPage: An error occured generating the report '"+getClass().getSimpleName()+"'"));
            }
            //else don't handle exception just pass it forward
            else throw new NSForwardException(ex);
        }
    }

Michael.

On 1/30/12 11:44 AM, James Cicenia wrote:
Are you using any bindings or such ?

I am not.

Thanks
James



On Jan 30, 2012, at 10:27 AM, Michael Hast wrote:

Hi James:

I copied and pasted the HTML below in my ERPDFWrapper page and it works. I had to remove the tag <webobject name="List"/> because there was no WOD definition. So my question is what does List return?

Otherwise it looks well-formed.

Michael.

On 1/30/2012 9:10 AM, James Cicenia wrote:
I am trying out ERPDFWrapper

but I get this exception:

The markup in the document preceding the root element must be
well-formed.:org.xml.sax.SAXParseException: The markup in the document
preceding the root element must be well-formed.
[2012-1-30 10:8:25 CST] <WorkerThread3>
com.webobjects.foundation.NSForwardException
[org.xml.sax.SAXParseException] The markup in the document preceding the
root element must be well-formed.:org.xml.sax.SAXParseException: The
markup in the document preceding the root element must be well-formed.
at
com.webobjects.foundation.NSForwardException._runtimeExceptionForThrowable(NSForwardException.java:45)
at er.pdf.builder.FlyingSaucerImpl.setSource(FlyingSaucerImpl.java:112)
at er.pdf.ERPDFUtilities.htmlAsPdf(ERPDFUtilities.java:123)
at er.pdf.ERPDFWrapper.responseAsPdf(ERPDFWrapper.java:87)
at er.pdf.ERPDFWrapper.appendToResponse(ERPDFWrapper.java:72)




<webobjectname="PDFWrapper">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en";>
<head>
<metacharset="utf-8"/>
<title>test</title>
</head>
<body>
<table>
<tr>
<td>
<webobjectname="List"/>
</td>
</tr>
</table>
</body>
</html>
</webobject>


What is not well formed?

Thanks
James




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected] <mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/mhast%40desertsky.com

This email sent to [email protected] <mailto:[email protected]>

--
Tel: (602) 279-4600 ext: 635
Desert Sky Software: www.desertsky.com <http://www.desertsky.com>
   Specializing in the Development and Hosting of
   e-Business Applications.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected] <mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/james%40jimijon.com

This email sent to [email protected] <mailto:[email protected]>



  _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected]  
<mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/mhast%40desertsky.com

This email sent [email protected]  <mailto:[email protected]>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected] <mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/pyu%40mac.com

This email sent to [email protected] <mailto:[email protected]>

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

This email sent to [email protected]

Reply via email to