Re: [xep-support] Transforming XmlDocument (Containing XSL-FO) to PDF

From: Alexander Peshkov (peshkov@renderx.com)
Date: Tue Oct 05 2004 - 09:12:23 PDT

  • Next message: klists@saphor.de: "Re: [xep-support] fo:table-footer?"

    Hello Leo,

    It turns out that the problem is caused by lInReader.MoveToContent()
    method call. If you remove it everything should work fine. Note that
    in your code this method is useless anyway so you can remove it safely.

    Best regards,
    Alexander Peshkov mailto:peshkov@renderx.com
    RenderX

    HL> Does anyone have any advice for me on this problem? I'm currently
    HL> evaluating a few different FO processors. I had no trouble getting the
    HL> other ones to work, but I like the feature list of this one.
    HL> Unfortunately, because of time constraints, if I can't get XEP working
    HL> soon, I'll have to choose another vendor.

    HL> BTW: I forgot to mention that I am using XEP.NET 3.8 on .NET 1.1.

    HL> Thanks!
    HL> Leo Hart

    HL> -----Original Message-----
    HL> From: Hart, Leo
    HL> Sent: Friday, October 01, 2004 4:23 PM
    HL> To: xep-support@renderx.com
    HL> Subject: [WARNING: This message originated from outside of Fidelity]
    HL> [xep-support] Transforming XmlDocument (Containing XSL-FO) to PDF

    HL> I have a function that accepts an FO document in the form of a
    HL> System.Xml.XmlDocument and returns a PDF in the form of a Byte array.

    HL> Here's the function:

    HL> Public Shared Function TransformXslFOToPDF(ByRef
    HL> pXslFODocument As XmlDocument) As Byte()
    HL> m_log.Debug("Transforming XSL-FO to PDF: " &
    HL> vbCrLf & pXslFODocument.OuterXml)

    HL> 'Holds the outgoing PDF stream
    HL> Dim lOutStream As New MemoryStream

    HL> 'Get Xmldocument into Stream
    HL> Dim lInStream As New MemoryStream
    HL> pXslFODocument.Save(lInStream)
    HL> lInStream.Position = 0

    HL> 'Get Stream into XmlReader
    HL> Dim lInReader As New XmlTextReader(lInStream)
    HL> lInReader.MoveToContent()

    HL> 'Configuration settings for Formatter
    HL> Dim lConfigSettings As New Hashtable
    HL> lConfigSettings.Add("ROOT", "C:\Program
    HL> Files\RenderX\XEP.NET 3.8")

    HL> 'FO Formatter
    HL> Dim lFormatter As New
    HL> Renderx.Xep.Formatter(lConfigSettings, Nothing)

    HL> lFormatter.Format("", lInReader, lOutStream,
    HL> Formatter.OUTPUT_PDF, lConfigSettings, Nothing)

    HL> Return lOutStream.GetBuffer
    HL> End Function

    HL> And here's the FO that exists within pXslFODocument:

    HL> <fo:root
    HL> xmlns:rx="http://www.renderx.com/XSL/Extensions"
    HL> xmlns:fo="http://www.w3.org/1999/XSL/Format">
    HL> <fo:layout-master-set>
    HL> <fo:simple-page-master
    HL> master-name="my-page">
    HL> <fo:region-body margin="1in" />
    HL> </fo:simple-page-master>
    HL> </fo:layout-master-set>
    HL> <fo:page-sequence master-reference="my-page">
    HL> <fo:flow flow-name="xsl-region-body">
    HL> <fo:block>Hello
    HL> World!</fo:block>
    HL> </fo:flow>
    HL> </fo:page-sequence>
    HL> </fo:root>

    HL> When I run this test case I receive the following error:

    HL> Exception: Renderx.Xep.XepInvalidOperationException
    HL> Message: startDocument: Invalid XSL FO source
    HL> 'file:/C:/WINDOWS/system32/': 1 error found during validation
    HL> Source: Renderx.Xep.Public
    HL> at Renderx.Xep.Sax.ContentHandler.endDocument()
    HL> at
    HL> Renderx.Xep.Sax.Adapter.XmlReaderToSax.WriteEndDocument()
    HL> at
    HL> Renderx.Xep.Sax.Adapter.XmlReaderToSax.Parse()
    HL> at Renderx.Xep.Formatter.Format(String
    HL> sBasePath, XmlReader reader, Stream outStream, String sOutFormat,
    HL> Hashtable htGenProperties, Logger logger)
    HL> at
    HL> Sandbox.Library.XML.Transformer.TransformXslFOToPDF(XmlDocument&
    HL> pXslFODocument) in C:\Documents and Settings\a122695\My Documents\Visual
    HL> Studio Projects\Sandbox\LibrarySandbox\Classes\XML\Transformer.vb:line
    HL> 60
    HL> at Sandbox.Web.GetPDFFromXSL_FO.Page_Load(Object
    HL> sender, EventArgs e) in
    HL> C:\Inetpub\WWWRoot\WebSandbox\ASP\XML\GetPDFFromXSL-FO.aspx.vb:line 43

    HL> I assume this is related to the fact that the sBasePath parameter in
    HL> lFormatter.Format is set to a null string. I can't figure out what I'm
    HL> supposed to use this for. I've tried various different file and http
    HL> paths, but all of them error out. I just want to convert my
    HL> memory-based FO document to a memory-based PDF.

    HL> Any suggestions?

    HL> Thanks,
    HL> Leo Hart

    HL> -------------------
    HL> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    HL> in the body of the message to majordomo@renderx.com from the address you
    HL> are subscribed from.
    HL> (*) By using the Service, you expressly agree to these Terms of Service
    HL> http://www.renderx.com/tos.html

    HL> -------------------
    HL> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    HL> in the body of the message to majordomo@renderx.com from the address
    HL> you are subscribed from.
    HL> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html

    -------------------
    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to majordomo@renderx.com from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



    This archive was generated by hypermail 2.1.5 : Tue Oct 05 2004 - 09:32:01 PDT