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

@mukesh958,

After an initial test with the licensed latest version of Aspose.Words for .NET i.e. 19.5, we were unable to reproduce this issue on our end. We would suggest you please upgrade to the latest version of Aspose.Words for .NET. Hope, this helps.

See sample input/output documents. docs.zip (150.1 KB)

We used the following simple code on our end for testing:

Document doc = new Document("E:\\temp\\HTMLPage1.html");
doc.Save("E:\\Temp\\19.5.docx");
doc.Save("E:\\Temp\\19.5.pdf");

In case you still observe the problem on your end, please also provide a comparison screenshot highlighting the problematic areas in Aspose.Words generated PDF and attach it here for our reference. Please point out the exact problematic places for this issue. We will then investigate the issue on our end and provide you more information.

@awais.hafeez

We are using “Aspose.Words” through JAVA. Please find the JAAR file of Aspose.Words in zip format that we are using in java…

Aspose.zip (7.6 MB)

If any upgration required in Aspose.Words jaar for java , let me know.

@mukesh958,

You are using older version of Aspose.Words. Please use the latest version of Aspose.Words for Java 19.5.

@tahir.manzoor-

Our Development environment is on JAVA 6, while we are using this latest Aspose.Words for Java 19.5, we are getting the following compilation issue…

 [javac] warning: com\aspose\words\internal\zz6E.class(com\aspose\words\internal:zz6E.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\DocumentBase.class(com\aspose\words:DocumentBase.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\CompositeNode.class(com\aspose\words:CompositeNode.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\zzZOX.class(com\aspose\words:zzZOX.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\ParagraphFormat.class(com\aspose\words:ParagraphFormat.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\RunCollection.class(com\aspose\words:RunCollection.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\Inline.class(com\aspose\words:Inline.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\RowCollection.class(com\aspose\words:RowCollection.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 [javac] It is recommended that the compiler be upgraded.
 [javac] warning: com\aspose\words\RowFormat.class(com\aspose\words:RowFormat.class): major version 51 is newer than 50, the highest major version supported by this compiler.

If it is java version problem then it is not possible for us to upgrade the JAVA as well as ASPOSE.WORDS version.
Please provide some alternative solution of this problem on JAVA 6.

Thanks!!

@mukesh958,

Starting from Aspose.Words for Java 19.3, we had upgraded the release JAR of Aspose.Words for Java from JDK 6 to JDK 7. The public release of Aspose.Words for Java contains only one JAR i.e. is built with JDK 1.7. The best option for you is to move to modern/latest JDK. In the meantime, we can also provide you a JDK 1.6 JAR on demand for smooth transition. We are currently building a JAR using JDK 1.6 for you and will share it with you when it will be ready. Please stay tuned.

@mukesh958,

You can download Aspose.Words for Java 19.5 JDK 1.6 version from the following link:
https://www.dropbox.com/s/b5gt8b0wniofcsn/Aspose.Words.jdk16.jar?dl=0

Hope, this helps.

@awais.hafeez- We have compiled our code with the above provided https://www.dropbox.com/s/b5gt8b0wniofcsn/Aspose.Words.jdk16.jar?dl=0 , but getting the same compilation issue.

 warning: com\aspose\words\internal\zz6E.class(com\aspose\words\internal:zz6E.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\DocumentBase.class(com\aspose\words:DocumentBase.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\CompositeNode.class(com\aspose\words:CompositeNode.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\zzZOX.class(com\aspose\words:zzZOX.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\ParagraphFormat.class(com\aspose\words:ParagraphFormat.class): major version 51 is newer than 50, the highest major version supported by this compiler
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\RunCollection.class(com\aspose\words:RunCollection.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\Inline.class(com\aspose\words:Inline.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\RowCollection.class(com\aspose\words:RowCollection.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.
 warning: com\aspose\words\RowFormat.class(com\aspose\words:RowFormat.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.

We are using JDK6 along with this Aspose.words jaar. This jaar is not fitted on the JAVA6 .

Thanks!!!

@mukesh958,

We are checking this scenario and will get back to you soon.

@mukesh958,

Can you please reload/reset your environment e.g. remove Aspose.Words’ reference from project (clear project), add the JAR again and rebuild etc. We just checked the JAR (that we shared here) again - it is definitely jdk1.6, class version is 50. Hope, this helps.

@awais.hafeez While we are importing this new “Aspose JAAR” file that you have provided it has created the compilation issue in our source code for the following methods,

row.getRowFormat().setAllowAutoFit(false);

And while commenting this line of code, We are getting the discarded PDF, see the discarded PDF,

New PDF.pdf (379.1 KB)

Please suggest.

Thanks,
Mukesh Gupta

@mukesh958,

The AllowAutoFit property belongs to Table class; so, you should use it like this:

row.getParentTable().setAllowAutoFit(false);

Also, you are running Aspose.Words in evaluation mode. We suggest you please apply license before creating instance of Document class. In case the problem still remains, please ZIP and upload your input Word document and Aspose.Words (after applying license) generated PDF files showing the undesired behavior here for testing. We will investigate the issue on our end and provide you more information.

@awais.hafeez
I have replaced with the “row.getParentTable().setAllowAutoFit(false);” but it’s also detect the compilation issue.

We have the Aspose licencse, but to see the PDF result, it’s seems like our licence is not supported on you provided ASPOSE JAAR, Is we need new license or we need to upgrade our existing license.

Please suggest!!

@mukesh958,

Please post your license file and simplified Java application via private message. In order to send a private message with attachments, please click on my name and find “Message” button. (see steps). We will then investigate the issue with the license file and compilation error on our end and provide you more information. Please do not share your license file publicly in forum threads.

Hi @awais.hafeez,
My first concern it about to the method “row.getParentTable().setAllowAutoFit(false);” which is not belongs to the certifcate. It is the part of JAAR file that you have provided.

OK, but while I am trying to add the license , but there are no option to send the message.

See the below screenshot,message.png (21.4 KB)

Please suggest.

Thanks,
Mukesh Gupta

@mukesh958,

Yes, row.getParentTable().setAllowAutoFit(false); is part of the JAR which is attached to this post. Secondly, we have updated your account’s permissions. You should now be able to see/use this private Message option.

The method “row.getParentTable().setAllowAutoFit(false);” is misssing in the jaar that you have provided.

We have send the License.

Please have a look.

Thanks,
Mukesh Gupta

@mukesh958,

We have checked your license. It has expired long time ago. If you please open it with Notepad (do not edit any content), you will notice the following tag:

<SubscriptionExpiry>20110831</SubscriptionExpiry>

Also, we observe the following exception when using the latest version of Aspose.Words for Java i.e. 19.5:

java.lang.IllegalStateException: The subscription included in this license allows free upgrades until 31 Aug 2011, but this version of the product was released on 01 May 2019. Please renew the subscription or use a previous version of the product.

Also, the following code works fine on our end:

    import com.aspose.words.*;
    public class Program {
        public static void main(String[] args) throws Exception {
            License lic = new License();
            lic.setLicense("E:\\temp\\Aspose.Total.Java.lic");
            Document doc = new Document("E:\\temp\\in.docx");
            Table tab = doc.getFirstSection().getBody().getTables().get(0);
            Row row = tab.getFirstRow();
            row.getParentTable().setAllowAutoFit(false);
        }
    }

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