We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word wrapping XML:FO

We recently started using your product instead instead of our previous choice of PDF-generator.
We use XML:FO styled text documents to transform into PDF binary streams.
It might look like something simple as this:

public byte[] GeneratePdf(Stream xmlfo)
    xmlfo.Position = 0;
    using (var document = new Aspose.Pdf.Document(xmlfo, new XslFoLoadOptions()))
        using (var output = new MemoryStream())
            document.Save(output, SaveFormat.Pdf);
            return output.ToArray();

Now, what we want to add is word wrapping.
We are aware of there is no real word-wrap (As it’s implemented in CSS for example, in the sense of wrapping both words and break very long words) support built into XML:FO, but in our previous product we where able to set word wrapping to the component itself.
We did find the Enum WordWrapMode.DiscretionaryHyphenation in your .NET implementation of the product but could not find any way to use this in a scenario as described in the code above.
Is it possible to apply word wrapping to loaded XML:FO using your product?

1 Like


You can wrap text on adding a paragraph text in the PDF document as narrated in this help topic: Add Text using Text Paragraph. Kindly send us the sample XML:FO and expected output PDF documents. We will take a closer look and share our findings with you.