• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDFWrapper Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDFWrapper Error


  • Subject: Re: PDFWrapper Error
  • From: Michael Hast <email@hidden>
  • Date: Tue, 31 Jan 2012 08:57:21 -0700

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

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

--
Tel: (602) 279-4600 ext: 635
Desert Sky Software: 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@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
_______________________________________________
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

References: 
 >Re: PDFWrapper Error (From: Michael Hast <email@hidden>)
 >Re: PDFWrapper Error (From: Michael Hast <email@hidden>)
 >Re: PDFWrapper Error (From: Paul Yu <email@hidden>)

  • Prev by Date: Re: ERXD2WList et al.
  • Next by Date: ERRest mini boot camp at WOWODC
  • Previous by thread: Re: PDFWrapper Error
  • Next by thread: looking for example
  • Index(es):
    • Date
    • Thread