System.SystemException: At least one of minimum, optimum, or maximum IPD

Jun 7, 2010 at 5:49 PM
Edited Jun 7, 2010 at 5:54 PM

Hi,

I am getting the following error when trying to generate PDF from fo file


System.SystemException: At least one of minimum, optimum, or maximum IPD must be specified on table.
   at Fonet.FonetDriver.FireFonetError(String message)
   at Fonet.Fo.Flow.Table.SetIPD(Boolean bHasProportionalUnits, Int32 maxAllocIPD)
   at Fonet.Fo.Flow.Table.CalcFixedColumnWidths(Int32 maxAllocationWidth)
   at Fonet.Fo.Flow.Table.Layout(Area area)
   at Fonet.Fo.Flow.Block.Layout(Area area)
   at Fonet.Fo.Flow.TableCell.Layout(Area area)
   at Fonet.Fo.Flow.TableRow.Layout(Area area)
   at Fonet.Fo.Flow.AbstractTableBody.Layout(Area area)
   at Fonet.Fo.Flow.Table.Layout(Area area)
   at Fonet.Fo.Flow.Block.Layout(Area area)
   at Fonet.Fo.Flow.Flow.Layout(Area area, Region region)
   at Fonet.Fo.Flow.Flow.Layout(Area area)
   at Fonet.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
   at Fonet.StreamRenderer.Render(PageSequence pageSequence)
   at Fonet.Fo.FOTreeBuilder.EndElement()
   at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)

Jun 9, 2010 at 6:49 AM
Edited Jun 9, 2010 at 6:49 AM

Hi,

You'll probably need to post a reduced bit of XSL-FO code that exhibits the problem.

Cheers

Marrow

Jun 24, 2010 at 12:20 PM
Hi, The number of cells defined in a row may be higher than the number of columns defined for the table. Check the table. Regards, Vinoth
Jun 20, 2011 at 5:37 AM

I recently deigned my Xslt to create an FO report.  I used XSelerator to build the Xslt and preview it easily via Fonet.exe command line configuration.  The main problem is that everything renders perfectly fine when using Fonet.exe!  However, once I integrated Fonet.dll into my .Net (C#) application I keep getting this same error.  Why would the FO run perfectly when run via Fonet.exe, but throw this exception when using it within my application (via Fonet.dll)???

Any help is greatly appreciated!

System.SystemException: At least one of minimum, optimum, or maximum IPD must be specified on table.
   at Fonet.FonetDriver.FireFonetError(String message)
   at Fonet.Fo.Flow.Table.SetIPD(Boolean bHasProportionalUnits, Int32 maxAllocIPD)
   at Fonet.Fo.Flow.Table.CalcFixedColumnWidths(Int32 maxAllocationWidth)
   at Fonet.Fo.Flow.Table.Layout(Area area)
   at Fonet.Fo.Flow.Block.Layout(Area area)
   at Fonet.Fo.Flow.Block.Layout(Area area)
   at Fonet.Fo.Flow.Block.Layout(Area area)
   at Fonet.Fo.Flow.Flow.Layout(Area area, Region region)
   at Fonet.Fo.Flow.Flow.Layout(Area area)
   at Fonet.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
   at Fonet.StreamRenderer.Render(PageSequence pageSequence)
   at Fonet.Fo.FOTreeBuilder.EndElement()
   at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)

My application code is very simple:

        public static FileInfo TransformXslFOToPdf(this FileInfo xslFOInputFileInfo, FileInfo pdfOutputFileInfo, XslFOPdfOptions pdfOptions)
        {
            XslFONetHelper.ValidateXslFOInputFileHelper(xslFOInputFileInfo);
            XslFONetHelper.ValidatePdfOutputFileHelper(pdfOutputFileInfo);

            //Render the Binary PDF Output
            FonetDriver pdfDriver = XslFONetHelper.GetFoNetDriverHelper(pdfOptions);
            pdfDriver.Render(xslFOInputFileInfo.FullName, pdfOutputFileInfo.FullName);

            //Validate the rendered binary output
            if (pdfOutputFileInfo == null || !pdfOutputFileInfo.Exists)
            {
                throw new FileNotFoundException(String.Format("The rendered PDF File does not exist or cannot be found [{0}]; Xml FO Rendering was not completed successfully.", pdfOutputFileInfo.FullName));
            }

            //Return the rendered Output FileInfo for chaining
            return pdfOutputFileInfo;
        }

Jun 20, 2011 at 6:21 AM

I finally solved my problem.  I was getting this error all along but did not realize that it was being output because XSelerator was hiding the console outputs from me.  Fonet.exe is handling the errors and allowing them to pass and the rendering completes successfully!  The final solution was simple, I have to wire up an event delegate to the OnError event of the Fonet driver.

The following code wires up the event:

            //Assign the ErrorHandler if defined
            if(errorHandler != null) pdfDriver.OnError += errorHandler;


And the following code is how I'm now handling these events to allow the rendering to complete just as with Fonet.exe:

        StringBuilder _errorMessage = new StringBuilder();
        public void Fonet_OnError(object driver, Fonet.FonetEventArgs e)
        {
            _errorMessage.AppendLine(e.GetMessage());
        }

Finally I simply call my transform with an easy call like:

            _errorMessage.Clear();
            pdfBinaryFileInfo = xslFOSourceFile.TransformXslFOToPdf(pdfBinaryFileInfo, pdfOptions, this.Fonet_OnError);
            this.LoadFile(pdfBinaryFileInfo);

            String errorMessage = _errorMessage.ToString();
            if(!String.IsNullOrEmpty(errorMessage) MessageBox.Show(errorMessage);

 

Here is an updated version of my extension method below:

       public static FileInfo TransformXslFOToPdf(this FileInfo xslFOInputFileInfo, FileInfo pdfOutputFileInfo, XslFOPdfOptions pdfOptions, FonetDriver.FonetEventHandler errorHandler)
        {
            XslFONetHelper.ValidateXslFOInputFileHelper(xslFOInputFileInfo);
            XslFONetHelper.ValidatePdfOutputFileHelper(pdfOutputFileInfo);

            //Render the Binary PDF Output
            FonetDriver pdfDriver = XslFONetHelper.GetFoNetDriverHelper(pdfOptions);
           
            //Assign the ErrorHandler if defined
            if(errorHandler != null) pdfDriver.OnError += errorHandler;

            //Render the Pdf Output
            pdfDriver.Render(xslFOInputFileInfo.FullName, pdfOutputFileInfo.FullName);

            //Validate the rendered binary output
            pdfOutputFileInfo.Refresh();
            if (pdfOutputFileInfo == null || !pdfOutputFileInfo.Exists)
            {
                throw new FileNotFoundException(String.Format("The rendered PDF File does not exist or cannot be found [{0}]; Xml FO Rendering was not completed successfully.", pdfOutputFileInfo.FullName));
            }

            //Return the rendered Output FileInfo for chaining
            return pdfOutputFileInfo;
        }