Free Support Forum - aspose.com

Conversion from .rtf to .pdf

aspose.pdf bind xml method fails due to floating box error while converting from .rtf to pdf . I have attached the .rtf file that failed. Please test and let me know the solution.I am getting the following error

Unknown sub element in FloatingBox element. The element name is FloatingBox.

Thanks,

Hariharan

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I can’t reproduce this issue on my side. I use the latest versions of Aspose.Words and Aspose.Pdf for testing. You can download these versions from here:

Aspose.Words 5.2.1:

http://www.aspose.com/community/files/51/file-format-components/aspose.words/entry133970.aspx

Aspose.Pdf 3.7.0.0

http://www.aspose.com/community/files/51/file-format-components/aspose.pdf/entry133741.aspx

Hope this helps.

Best regards.

The content of the file seems to be good but the rectangular boxes around the content seems to be missing and a back ground shading seems to come in certain boxes.

I have attached the pdf file created with the new version.

I have also attached the rtf version of the doc.

Any help in this regard will be greatly appreciated.

Thanks,

Hariharan

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional materials.

On the latest versions of Aspose.Words and Aspose.Pdf I obtained different result. The only issue is that white boxes disappear. All text frames are visible but without white boxes. There is something wrong with Z-order calculation in Aspose.Words. I have created a new issue in our defect database #5738. We’ll notify you on any progress or when it is fixed.

I played a bit trying to find a workaround for this document. The only thing I came to is modifying intermediate XML in some places. Below are two fragments corresponding to the big grey box and one of the disappearing boxes. When I changed ZIndex="-18" to ZIndex="0" it became visible. That’s affordable if you have one steady template and document structure never changes. Then you can find all such invisible boxes in the XML and modify Zindex attribute.

<FloatingBox Width="480" Height="294" ZIndex="-1" BoxHorizontalAlignment="None" BoxHorizontalPositioning="Page" BoxVerticalAlignment="None" BoxVerticalPositioning="Page" Left="18" Top="336.8">

<FloatingBox Width="159.4" Height="139.5" ZIndex="-18" BoxHorizontalAlignment="None" BoxHorizontalPositioning="Page" BoxVerticalAlignment="None" BoxVerticalPositioning="Page" Left="21" Top="484.5">

Regards,

I have tried to modify the xml for Z-Index and still the boxes around the text seems to be missing. Could you tell me how long will it take to fix the issue with aspose.words? I downloaded the aspose.pdf and aspose.words from the url you have sent me yesterday. I have a different version of aspose.pdf.kit in my local machine. Do i have to update the version of the kit? I was thinking the boxes missing would have to do with the older version of aspose.pdf.kit.

Please clarify and let me know your ideas on this issue.

Any help in this regard will be greatly apppreciated.

I have attached the pdf which was generated using aspose words from .doc .

when i genetrate the pdf using word sometimes the document gets generated with boxes and sometimes it is not. The pdf generation is not having a consistent look when converting from doc using aspose.words.

Thanks,

Hariharan

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your inquiry.

Aspose.Pdf.Kit is not involved in doc2pdf conversion. So that’s doesn’t matter what version of Aspose.Pdf.Kit is installed. Ensure that you have the latest versions of Aspose.Words and Aspose.Pdf.

I cannot give any timeframe for #5738. We’ll take a look before the next hotfix (3-4 weeks) but don’t guarantee a resolution. Please share an e-mail address here so I could send back materials to explain what I suggest to do as a workaround.

That’s interesting if you are getting intermittent results: sometimes with boxes and sometimes without them. Would you please attach also intermediate XML files for both cases?

Regards,

I have attached the xml for both the scenarios.(one without border and the one with border).

My email address is hramachandran@arifleet.com.

Thanks,

Hariharan

Wow! I thought from your post that you are getting intermittent results on the same document and the same environment. To say what’s wrong with these two I have to see original documents too. I’ll try to patch the XML produced from the first document you attached and send materials back. We’ll suggest together what to do next.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Regards,

I was getting differnet results from different documents and the same environment. For each document i generate i have different data in the report but the layout is the same.

I am attaching the original document for both cases.

Thanks,

Hariharan

Hello Hariharan!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for these attachments. But I’m confused since they are unrelated with intermediate XML files you attached previously. They were created from different sources.

Anyway I found an easier workaround. You can change only one Z-order value in every XML file. I’m sending what I get by e-mail. Consider this fragment again:

This is the big floating box containing some others inside. And it overlaps them because ZIndex value is greater. You can change ZIndex to something like -1000 so it would be less than anything else. If you are creating all files from the same template then you will have this floating box in every file. You can find it using regular expressions and replace ZIndex. This string will occur steadily:

FloatingBox Width="480" Height="294"

ZIndex itself won’t be always -1, it might vary. So don’t rely on its original value.

To patch XML files programmatically the following approach is good to implement:

1. Save intermediate XML to a stream.

2. Read the stream as text into a string variable.

3. Apply some regex replacement logic.

4. Write the result string to another stream.

5. Bind the second stream to Aspose.Pdf.Pdf object.

6. Save PDF.

Let me know whether this helps.

Regards,

The issue in Aspose.Words + Aspose.Pdf conversion will not be fixed. Please use the Aspose.Words direct to PDF conversion method.