Aspose.Word to Aspose.PDF conversion

Hi Tommy,

I have implemented a Document Production Service which merges XML data with an MS Word Template through Aspose.Word to give Word document output.

I am now implementing extra functionality to allow users to view output documents in PDF format. I am doing this by outputing Aspose.PDF ‘ready’ XML from Aspose.Word and then loading this into Aspose.PDF to give the resulting PDF output.

I realise we will not get an exact match between Word and PDF output, but there are some issues between the 2 outputs I am hoping you may be able to help me remedy.

1.) The first is a blank page printing on the first page of the PDF output which does not exist in the Word template.
2.) The second is the bottom margin of a table printing off the page when it should be closing off after the last table cell is populated.
3.) The third is the spacing of the Address information at the top of the page and justification of text in the template around mergefields in the main body of the document.

I will send you through the template document, the input XML, the C# code, and the resulting Word and PDF output’s to <a target="_blank" title=“mailtoStick out tonguedf@aspose.com” href=“mailtoStick out tonguedf@aspose.com”>pdf@aspose.com for your perusual.

Thanks for you help.

Regards,
Rich.

Dear Rechard,

Thank you for considering Aspose.

Please download hotfix here.

Hi Tommy,

These issues came from output using Aspose.Word 1.8.1.0 and Aspose.PDF 1.9.1.0
I am already using the hotfix you advised me to use.

Thanks,
Rich.

Hi Tommy,

Could I please get some feedback on these issues. I need to the them resolved as soon as possible so I can release the service to the business.

Thanks,
Rich.

Dear Richard,

Thank you for considering Aspose.

I have fixed the bug you reported but did not release a new version. Have you tried the hotfix? If you are not satisfied with it, please tell me on detail.

Hi Tommy,

Sorry, I did not realise you had released a new version under the existing hotfix label.

The results are fantastic, we just about have a perfect match now.

We still have the issue of a blank page printing on the first page of the PDF output. Have you been able to recreate this error?
We are using Adobe Reader 6.0.1 to view the PDF output if that helps.

Thanks alot.
Rich.

Dear Richard,

Thank you for considering Aspose.

I can’t reproduce this error. I used the WordOutput.doc you sent to me and converted it to PDF. Did you use this document to test? If you used a new document, please send it to me.

Hi Tommy,
I have emailed to you the template document, the input XML, and the resulting Word and PDF output's for your perusal.
I am still using the C# code I sent to you last week, this has not changed.
As you can see there is a blank page printing on the first page of the PDF output which does not exist in the Word template or the Word output.
Thanks for you help.
Rich.

Dear Richard,

Thank you for considering Aspose.

I download the Aspose.Pdf.dll from our server and tested the document you sent to me but I still can reproduce this error. Are you sure you are using the latest hot fix?
I used the following code:
Word word = new Word();
Document doc = word.Open(@"E:\Temp\DrawDown.doc");
doc.Save("e:/temp/DrawDown.xml",SaveFormat.FormatAsposePdf);

Pdf pdf = new Pdf(@"e:\projects\CSharp\customer\Aspose.Format.lic");
pdf.BindXML("e:/temp/DrawDown.xml",null);

pdf.Save("e:/temp/DrawDown.pdf");

Hi Tommy,

Thanks for you code example, I have an xtra line of code in my conversion process I didn’t need, I altered my code which got rid of the blank leading page in the output document.

I now have an issue with an updated template which contains a fixed text box holding the document receiptient at the top of the page.

The text contains 2 merge fields, one holds the receiptient name and the other contains the receiptient address.

The receiptient address mergefield contains the entire address block, where each address line is seperated by a carriage return(\r).

Passed through in XML as;
<AddressOutput>PO Box 87\r22 Grenville Street\rSt Helier\rJersey\rJE4 8PX\rUnited Kingdom</AddressOutput>

Displayed on output document as;
PO Box 87
22 Grenville Street
St Helier
Jersey
JE4 8PX
United Kingdom


Aspose.Word manages the carriage returns correctly and does not resize the text box in the MS Word output which is what is expected, but Aspose.PDF resizes the text box in the PDF output which is incorrect.

I will email the necessary components through to you for testing.

Thanks for your help.

Regards,
Rich.

Hi Richard,

I have not received your email. Have you sent it?

Hi Tommy,

I did send the email, it may have got held up somewhere.
I will send it again.

Cheers,
Rich.

Dear Richard,

Thank you for considering Aspose.

In fact, Aspose.Pdf does not resize the text box. But there is small difference about line spacing between Aspose.Word and Aspose.Pdf. I have changed my code to make the pdf looks more like the Word document. Please download hot fix here.

Hi Tommy,

The difference in line spacing between Word and PDF is minimal, that isn’t an issue for us, we don’t expect them to be identical.

But we still have the issue of the large gap between the bottom of the address block and the ‘VIA:’ field.

I get a 2.3 cm space on the Word output which is what was expected, but I get 4.6 cm space on the PDF output.
The PDF seems to double the size of this space.

I would appreciate any ideas you have on this issue.

Thanks,
Rich.

Dear Richard,

Thank you for considering Aspose.

As you can see from the XML, there are more blank lines than in the Word document. I have forward your email to the Aspose.Word team and we will cooperate to solve this problem.

The extra blank spaces in this document are because you are using a textbox for the client information.

In MS Word document, the textbox floats over text and underneath it there are 6-7 empty paragraphs that tab the main text down.

Aspose.Pdf does not support absolute positioned floating textboxes and the textbox is rendered “inline”. Therefore you get the height of the textbox plus the height of those empty paragraphs that in MS Word documed were beneath the textbox. This caused the extra empty space.

I suggest you avoid using textboxes if you need better conversion from DOC to PDF.

Hi Tommy,

In your email reply to me regarding this issue, you stated…

Aspose.Pdf does not support absolute positioned floating textboxes.

Is it you intention to support this functionality in the future.

The templates we use for our Document Production Service generally all use text boxes for the address information.

This due to the fact that our address block is all in one merge field seperated by carriage returns.

This makes our address block varable length, so we put it into a text box in order to anchor our main text body and stop it moving up the page if a short address block is printed.

Thanks,
Rich.

Dear Richard,

Thank you for considering Aspose.

I have supported absolute positioning of paragraph. But a floating textbox can has many paragraphs. So I have to do more work to support absolute positioning of textbox. But I have to start this work when I have finished my current task which hopes to be at the end of this month.

Thanks Tommy,

I appreciate you are currently working on a another task, and will not be able to look at this until you have completed wgat you are doing.

I also appreciate that you are going to look at the floating text box issue. It will be a great piece of functionality for us.

Thanks,
Rich.

Hi Tommy,

I want to get an update on the support of absolute positioning of floating textboxes in Aspose.PDF.

I have been running tests outputting PDF's from a Word template, using Aspose.Word and Aspose.PDF, and this issue does not seem to be resolved yet.

We will be requiring this as we are wanting to give our Document Production service the functionality to output to PDF.

Any assistance would be greatly appreciated.

Thanks,
Rich.