Word to Pdf: Justify in multisegment text

From dannyaj:

dannyaj says:
I am testing the Aspose.Word and Aspose.Pdf and am having some issues. What I would like to do is get a
Word document converted to a Pdf. From what I could gather on the website this would involve saving the
Word document to the xml format then using the xml to create the pdf. With just a simple word doc (not
the type of document it would be used on), I get the following error in the pdf…
dannyaj says:
creation part: An unhandled exception of type ‘System.ApplicationException’ occurred in aspose.pdf.dll
Additional information: Justify and fulljustify is not supported in multi-segment text. Here is my code
snippet: Word w = new Word();
Document d = w.Open(“C:\WorkingFolder\test.doc”);
d.Save(“C:\WorkingFolder\test.pdf.xml”,SaveFormat.FormatAsposePdf);

dannyaj says:

XmlDocument xDoc = new XmlDocument();
xDoc.Load(“C:\WorkingFolder\test.pdf.xml”);

FileStream fs = new FileStream(“C:\WorkingFolder\test.pdf”,FileMode.Create);
Pdf pdf = new Pdf(fs);
pdf.BindXML(xDoc,null);
pdf.Close();
dannyaj says:
I’m not sure if this is the desired method so any help would be appreciated.

Hi dannyaj,

You are correct, it is necessary to save in Aspose.Pdf.Xml format first and then load that document into Aspose.Pdf. If you don’t want to use a file, you can save and load from a memory stream.

Currently it is a limitation in Aspose.Pdf that paragraphs marked as Justify (align both left and right sides vertically) and contain differently formatted text (say a bold word inside the paragraph) is not supported.

Aspose.Pdf team might indicate whether and when they are going to support this, but I thought about this issue once again and have a workaround in mind.

I can change Aspose.Word so it changes Justify alignment for such paragraphs to Left alignment. This will result in your right side not aligned vertically in PDF output (minor loss of formatting), but at least it will work. I will implement this workaround by Monday.

Dear dannyaj,

Thank you for considering Aspose.

It’s really a limitation in Aspose.Pdf that justify and full justify is not supported for multi-segment text paragraph. Since this problem is not easy to solve for us, we need much time. We hope to support this in middle August.