I am converting doc or docx to PDF using aspose.word.Document. There is some issue in margin while converting to PDF. I m attaching my both docx and converted PDF file in attachment. this is the code snipet:
com.aspose.words.Document doc = new com.aspose.words.Document(DocPath);
Thanks in advance for ur valuable supportTestConversion.zip (27.9 KB)
TestConversion.pdf (104.4 KB)
Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for Java 18.9 and have not found the shared issue. Please use Aspose.Words for Java 18.9. We have attached the output PDF with this post for your kind reference. 18.9.pdf (98.6 KB)
Thanks for the update.
There is file name in the footer. I wanted that file name should remain same as in docx file.
We have aspose.total license.
Thanks in advance
Thanks for your inquiry. Please use the following code example to get the desired output.
Document doc = new Document(MyDir + "TestConversion.docx");
for(HeaderFooter headerFooter : doc.getFirstSection().getHeadersFooters())
for(Field field : headerFooter.getRange().getFields())
doc.save(MyDir + "out.pdf");
Thanks for your update. It is not working in my case. Can you please give me the input and output file.
Because in my case it is not coming inside the for(Field field : headerFooter.getRange().getFields()) loop.
Thanks in advance
Thanks for your inquiry. Please use the latest version of Aspose.Words for Java 18.9. We have attached the input and output documents with this post for your kind reference. Docs.zip (120.1 KB)
Thank you for your valuable support. I am using the old Aspose.word jar for java. Now it is working fine as i wanted.
Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.