Preserve Paragraph Borders & Footer Banner on all Pages during Doc to PDF Conversion using Java API

Hi Team,

We have purchased(renew) the license, could you please share the “Aspose.Words” jaar file which will be support on java JDK1.6 version. So that we can check the schenerio.

Thanks,
Mukesh Gupta

@mukesh958,

Please download the required JAR file from following link.

Aspose.Words for Java 19.9 (JDK1.6 jar only)

HI Team,

By using the above JAAR, we are getting the issue of a method missing, the method which is missing:
row.getRowFormat().setAllowAutoFit(false);

Previousally team had been suggested to use method like this:
row.getParentTable().setAllowAutoFit(false);

But by replacing the method, our PDF are not in the expected format, it is discarted

find the attached discarted PDF

discart.pdf (380.7 KB)

It must be in proper format like this:

Test PG Border.pdf (235.2 KB)

Please suggest.

Thnaks,
Mukesh Gupta

@mukesh958,

Have you also tried the latest version of Aspose.Words for Java i.e. 19.9 on your end? In case the problem still remains, please ZIP and upload your input Word document, Aspose.Words generated PDF file showing the undesired behavior and piece of source code to reproduce this issue here for testing. We will then investigate the issue on our end and provide you more information. Thanks for your cooperation.

Hi @awais.hafeez,

I am using the latest aspose JAAR file that the team had been provided previousally Aspose.Words for Java 19.9 (JDK1.6 jar only).

Yes, I am getting the issue same as above mentioned, please find the attached DOC file on which we are writing our data in form of HTML content and some dynamic content on page.

TEMPLATE_SPEC_CSPG.zip (163.5 KB)

Please find the PDF that has the Bottom border issue .

Discarted PDF.pdf (709.9 KB)

In the above PDF the “Summary Information” data has a border and the border must be closed on the end , the summary information data are in the form of html content, that is directly write on the page through the method “insertHtml()” of “DocumentBuilder”.

Thanks
Mukesh Gupta

Hi Team,

I am attaching a console based application for writing data in PDF File.
I have tried to write the sample code which is currently working in our application and creating the problem.

Please find the attached sample code in resource.zip file.

resource.zip (190.8 KB)

The resource.zip file contains a template with name “TEMPLATE_SPEC_CSPG.doc” in which I am writing the code/data.
The resource.zip file also contains a main class with name of “AsposePDFDemo.java” . This class contains the main logic of writing content/data in PDF file.

The pages have some html content that are generated dynamically, these html content are fetching through “htmlContent.txt” file which is inside resource.zip file.

The complete generated output is saving in the file “generatedPG.pdf”.

I am also attaching a pdf file which has the bottom border issue in different pages like page 4, page 6, page 8, page 17, page 20 etc.

This pdf is the output of the given sample code.
generatedPG.zip (6.5 MB)

Please have a look on this issue and if it has any solution, please provide us.

Thanks,
Mukesh Gupta

@mukesh958,

We are working on your query and will get back to you soon.

@mukesh958,

While using the latest version of Aspose.Words for Java i.e. 19.12, we have produced a awjava-19.12.zip (214.4 KB) DOC file by using these resources WORDSNET-19712-resources.zip (189.7 KB) on our end. This DOC output looked good on our end when we observed/opened it with MS Word 2019.

However, we get this PDF awjava-19.12.pdf (583.9 KB) file when running the following simple code:

Document doc = new Document("E:\\TEMPLATE_SPEC_CSPG\\awjava-19.12.doc");
doc.save("E:\\TEMPLATE_SPEC_CSPG\\awjava-19.12.pdf");

And this PDF msw-2019.pdf (580.2 KB) file when doing a ‘Save As’ to PDF operation on awjava-19.12.doc by using MS Word 2019. In this case, it appears that MS Word 2019 and Aspose.Words for Java 19.12 both produce distorted PDF outputs.

However, for the sake of any correction in Aspose.Words, we have logged this problem (see screenshot.zip (193.4 KB)) in our issue tracking system. The ID of this issue is WORDSNET-19712. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Hi Team,

Is any update on this issue?

Thanks,
Mukesh Gupta

@mukesh958,

We have good news for you i.e. WORDSNET-19712 has now been resolved. The fix of this issue will be included in the 20.2 (next version) of Aspose.Words for Java. We will inform you via this thread as soon as the next version containing the fix of your issue will be released within next couple of days.

The issues you have found earlier (filed as WORDSNET-19712) have been fixed in this Aspose.Words for .NET 20.2 update and this Aspose.Words for Java 20.2 update.

Hi Team,
Currently we are using JDK 1.6 and Aspose.Words.jdk16.
It will not be possible for us to update our JDK 1.6 to 1.8 and also the Aspose.Words.jdk16.

Can you please share the possible alternate solution for this issue.

Thanks,
Mukesh Gupta

@mukesh958,

Please try the following package if you are using Aspose.Words for Java on an old Java 6 environment. It is Aspose.Words for Java 20.2 JAR compiled for JDK1.6

Hope, this helps.

Hi Team,

I am attaching a console based application for writing data in PDF File.
I have tried to write the sample code which is currently working in our application but after updating the jar (i.e. aspose-words-20.2-jdk16) we find some difference in font style and pdf border.

Please find the attached sample code in PDF-test.zip file.PDF-test.zip (349.7 KB)

PDF-test.zip file contains a template with name “TEMPLATE_SPEC_CSPG.doc” in which I am writing the code/data.
PDF-test.zip file also contains a main class with name of “AsposePDFDemo.java” . This class contains the main logic of writing content/data in PDF file.

The pages have some html content that are generated dynamically, these html content are fetching through “htmlContent.txt” file which is inside PDF-test.zip file.

The complete generated output is saving in the file “generatedPG.pdf”.

I am also attaching both pdf file for your reference :-

Previous jar (Aspose.Words.jdk16) PDF file “178KB-Oldjar-generatedPG.pdf” 178KB-Oldjar-generatedPG.pdf (455.3 KB)

New jar (aspose-words-20.2-jdk16) PDF file “178KB-Newjar-generatedPG.pdf” 178KB-Newjar-generatedPG.pdf (484.0 KB)

There is also difference in PDF file size when we integrate with our project.

Please have a look on this issue and if it has any solution, please provide us.

Thanks,
Dhirendra Joshi

@mukesh958,

With latest 21.7 version of Aspose.Words for Java and using the code your provided, I have produced a PDF file on my end and attached it here for your reference (see generatedPG produced by Aspose.Words 21.7.pdf (555.5 KB)). Do you still observe problems in this PDF? If yes, then please also provide a comparison screenshot highlighting (encircle) the problematic areas in this Aspose.Words 21.7 generated output PDF. Regarding PDF file size, in your generatePDF method, please specify JPEG quality using PdfImageCompression class:

    ...
    ...
    buildHeaderPage(builder);

    doc.updateFields();

    PdfSaveOptions opts = new PdfSaveOptions();
    opts.setImageCompression(PdfImageCompression.JPEG);
    opts.setJpegQuality(10);

    doc.save(filePath, opts);
}