Hi,
I am using ASPOSE PDF component for converting my Word documents to PDF files. I am facing an issue with the conversion: The artistic border in MS Word document is not converted properly to PDF. The ASPOSE component seems to not read the art boundary (red oval in the attached image - Word Page Border Issue.JPG) across the Word page and thus only converts the actual border (green rectangle in the attached image - Word Page Border Issue.JPG). The PDF users can’t see the art boundary.
Because of this, there is a “Look and Feel” issue that is being reported by some users. Please let me know if this is a default behavior OR I am seeing this because I am using the evaluation version of ASPOSE component. Also if there is some class/property that controls this behavior please share the same so that I can test it and make sure I am not missing something in the code.
Regards,
Vaibhav Modak
Hello Vaibhav,
Thanks for considering Aspose.
Aspose.Pdf offers the full capabilities/functionalities with evaluation version as compare to the full licensed version except for the fact that, an evaluation watermark is displayed on every page of the resultant PDF document.
You can also request a 30 days Temporary License to test the product. Please visit How to Get a temporary license
Can you please share the resource word documents that you are using so that we can test the issue at our end.
FYI, In recent versions of Aspose.Words a new feature of saving a word document directly into PDF format is introduced. This method does not require Aspose.Pdf for word to PDF conversion. For more information please visit Convert a Document to PDF
We apologize for your inconvenience.
Hi,
Thanks for all the assistance. I retried the code and found that there was some issue with the watermark image that was present in the source Word document. I inserted a new image as watermark and now its working fine.
Also regarding the option of saving the Word document directly to PDF, I know this concept as I have read about it earlier in your documentation but for our requirements we need the Word->XML->PDF approach as it gives us more control over the PDF generation and subsequent data population.
I have attached a sample Word document that I am using to test the conversion functionality. I have also attached the resulting PDF file as converted by ASPOSE component. Please test it for the “Page Border rendering issue” and share your comments.
I am using the following code to convert the Word document to PDF:
-------------------------------------------------------------------------------------------------------------------------------
string wordFile = @“D:\Templates\Sample Letter.docx”;
string xmlFile = @“D:\Templates\test.xml”;
string pdfFile = @“D:\Templates\Sample Letter.pdf”;
// New a Doc object.
Document doc = new Document(wordFile);
// Specify folder where images will be stored
doc.SaveOptions.PdfExportFormFieldsAsText = false;
doc.SaveOptions.PdfExportImagesFolder = System.IO.Path.GetTempPath();
// Save the doc in a xml fille that can be handled by Aspose.Pdf.
doc.Save(xmlFile, SaveFormat.AsposePdf);
// New pdf object.
Pdf pdf = new Pdf();
// Bind content from the named xml file.
pdf.BindXML(xmlFile, null);
// Save the result
pdf.Save(pdfFile);
-------------------------------------------------------------------------------------------------------------------------------
Regards,
Vaibhav Modak
Hello Vaibhav,
Thanks for the information and resource files.
I’ve tested the scenario and I’m able to notice the same problem. The issue has been reported to the development team and they are looking into the details of this problem and will keep you updated with the status of correction.
We apologize for your inconvenience.
Hello Vaibhav,
I have checked the issue. In my investigation, page borders created using Art objects are not supported in Aspose.Pdf and Aspose.Words at present. Sorry for inconvenience. I have reported it to Aspose Words team. They will share their expertise soon.
Best regards.
Hello!
Thank you for your inquiry.
I’m Viktor, the developer from Aspose.Words Team responsible for doc2pdf conversion
This document doesn’t contain a fully valid page border since line style is not there. That’s probably why Microsoft Word doesn’t show this border. Experimenting with this document I cannot guess what’s wrong. All I can do is avoiding border,
completely if not all mandatory attributes are specified.
Regards
Hello Viktor,
Thanks for all the assistance. In your post you have mentioned that line style and some other “mandatory attributes” are missing in the file. Please let me know about the attributes and also if they can be added from outside in the auto-generated intermediary XML file. I have control over the XML file and have an option to update the XML and then generate PDF again from that.
I am attaching the XML file with this post. Please have a look and share your comments about the border attributes and other related attributes therein which needs to be added for displaying the border properly.
Sorry for persisting with the requirement, but I want to give it my best shot before taking up the idea of abandoning the border art completely.
Thanks in advance,
Vaibhav Modak
Hello Vaibhav!
As my colleague wrote, border art is not supported in conversion to PDF using Aspose.Words + Aspose.Pdf. I don’t see workarounds other than just implementing this on both sides. But this should be considered with the Aspose.Pdf Team first. After they agree and implement the corresponding API we can add support on the Aspose.Words side.
Regarding attributes, I mean that line style is not specified right in the DOCX file. Maybe that’s why Microsoft Word doesn’t show the border at all. I suppose you have a proper document to experiment with. Anyway, we can output only simple borders to Aspose.Pdf XML.
Please also let us know what post-processing you perform on the intermediate XML. We would try to advise better solutions.
Regards,
Hi Viktor,
Thanks for all the support till now. I will update the team here with your comments and I think we need to get the border thing sorted at our end itself.
Regarding the post-processing on the intermediate XML, I am doing the following tasks:
1. Read a Word document template and generate the XML from it. The Word document has some placeholders (along with lot of static text) which need to be populated from the database. Store the XML for further processing.
2. Read the XML and data placeholders and dynamically set the data in there. Use this modified XML to generate the PDF. This will be used by the clients later on.
Although we have done a lot of brainstorming on this earlier and finally approached ASPOSE PDF as one of the most viable solutions I would like to know if any alternative is available for this requirement of ours.
Thanks…
Regards,
Vaibhav Modak
Hello!
Thank you for explanation.
In your case it would be good to utilize mail merge facilities. Please refer to our documentation and ask more specific questions if you get ones:
There are good samples of mail merge in our demos:
And samples:
The main idea is that you can do almost everything within the Aspose.Words document model, without the need of any textual post-processing. With mail merge you would migrate to the direct PDF export. It shows better performance, quality and even easier to code.
Regards,