Displaying checkbox in output pdf document

Hi Team,
I have purchased your product aspose word. We have a word template file with .dot extension.It has some checkboxes which are already “checked” in the template (for e.g current values required checkbox in attach template file).When i upload the template, it generated the pdf output properly along with the checkboxes. But the checkboxes in the output file are not checked (selected) even though those checkboxes in the input template document file are checked (i.e. selected). I am attaching the template for your reference.
Could you pls help and let me know, what i need to do so that those checkboxes are shown as selected in output pdf file?

Hi,

Thanks for your query. I have tested the scenario and have not found the issue with checkboxs while using latest version of Aspose.Words for .NET. Please use the latest version of Aspose.Words for .NET. I have attached the output PDF file with this post. Please let us know if you have any more queries.

Hi,
My apology for incomplete details. We are using Aspose words for java and below are details from manifest.mf about its version.
Specification-Title: Aspose.Words for Java
Specification-Version: 10.5.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 10.5.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2011.09.30
I am not able to get desired output. Do i need to buy a new license to use latest jar file for aspose.words for java? Can you pls help?

Hi,

Thanks for sharing the information. I have conveted the DOT file to PDF by using latest version of Aspose.Words for Java and have not found issue with checkbox. Please use the latest version of Aspose.Words for Java.

Every Aspose license carries one-year subscription for free upgrades to new versions released during this time. So, please check the expiration date of your license and upgrade to the newest version. To check an expiration date of your license open the license file using notepad. You will see the following tags:

20120218

It means that you can free upgrade to version of Aspose.Words published before 02/18/2012.
If you need to update to the latest version of Aspose.Words, but your license does not allow you to update to this version, you should contact Aspose sales team to renew your license.

https://forum.aspose.com/c/purchase/6

Hi Team,
I tried with latest version for aspose words for java. I am using Aspose.Words.jdk16.jar file.Below are details from manifest.mf

Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Specification-Version: 11.7.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 11.7.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2012.08.31

I am still not able to get desired output.Could you pls provide me the code which you are using to generate the pdf with checkboxes which are checked (i.e. selected)?
Thanks,
Prashant

Hi Prashant,

Thanks for sharing the details. I have used the following code snippet to convert DOT file to PDF. It would be great if you please share your working environment like Operating system, JDK version etc. Please also share your code along with output PDF file for investigation purposes.

Document doc = new Document(getMyDir() + "Inspection.dot");
doc.save(getMyDir() + "AsposeOut.pdf");

Below is the code which we are using to generate output pdf.The template file i.e. .dot file is uploaded by the user which is stored in database in bytearray format. This byte array is retrieved and passed to the below method getMailMergedData.
inputXml contains xml in below format

public byte[] getMailMergedData(byte[] docTemplate, String inputXml) throws Exception{
    byte[] mailMergedDataAsByteArray = null;
    //Aspose Part- input the DOT file
    Document doc = new Document(new ByteArrayInputStream(docTemplate));
    // Storing the xml input data file in memory.
    DocumentBuilder db = DocumentBuilderFactory.newInstance()
        .newDocumentBuilder();
    //Aspose-words needs xml doc as DOM Document object
    org.w3c.dom.Document xmlData = db.parse(
    new ByteArrayInputStream(inputXml.getBytes()));
    //Set the RemoveEmptyRegions to true in order to remove
    //un merged mail merge regions from the document.
    doc.getMailMerge().setRemoveEmptyRegions(true);
    //Executing Aspose mail merge engine
    doc.getMailMerge().executeWithRegions(
    new XmlMailMergeDataSet(xmlData));
    //Saving generated mail merged doc as mentioned save format
    ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
    doc.save(dstStream, SaveFormat.PDF);
    //Reading the final result into a Document object again
    mailMergedDataAsByteArray = dstStream.toByteArray();
    logger.info("Mail merged file have been genereated and saved");
    return mailMergedDataAsByteArray;
}

Any help will be appreciated!!

Hi Prashant,

Thanks for sharing the details. Please find the output PDF file in attachment. I have not found any issue with CheckBoxes. It would be great if you please share your working environment like Operating system, JDK version etc.

We are using AIX box and we are using jdk 1.6.

Hi Team,
I don’t see the problem ON WINDOWS SYSTEM.The problem occurs only on Unix and AIX system only.

Hi Prashant,

Thanks for the additional information. I had tested this issue at Windows 7 Operating Systems and had not found any issue while using latest version of Aspose.Words for Java. We are preparing the required platform to simulate the environment as of yours. As soon as everything is setup, we will test the issue on our end and will post the results here for your kind reference.

Thank you for your patience and understanding.

Hi Prashant,

Thanks for your patience.

I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7017 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Prashant,

I have received response from our development team on this issue and like to share with you that "Wingings 2 " font is used by Aspose.Words for rendering check boxes.

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (PDF, XPS or SWF). Aspose.Words selects the fonts according to the following process:

Aspose.Words tries to find the required font among the fonts embedded in the original document. Some document formats such as DOCX can contain embedded fonts.
Next, Aspose.Words tries to find a font on the file system with an exact font name match.
If Aspose.Words cannot find a font with the exact name match, Aspose.Words attempts to select the most suitable font from all of the available fonts.
Finally, if Aspose.Words cannot find any fonts on the file system, it renders the document using the free Gentium font that is embedded into the Aspose.Words assembly.

When you render your document to PDF, Aspose.Words requires "Wingings 2 " font to be installed on your Linux system. Please see the following workarounds:

Please install "Wingings 2 " on your Linux machine.
Instead of default location, if your font is located in some other directory, then you have to specify the location of the directory that contains the fonts. Please see the following code snippet:

Document doc = new Document(MyDir + "Rendering.doc");
// Set fonts to be scanned for under the specified directory. Do not search within folders nested this folder.
FontSettings.SetFontsFolder(@"C:\MyFonts</span>", false);
doc.Save(MyDir + "SetFontsFolder Out.pdf");

Moreover, I would suggest you please read the following article on How-to: Install True Type Fonts on Linux:
https://docs.aspose.com/words/net/installing-truetype-fonts-on-linux/

Please let us know if you have any more queries.

Hi Team,
My apologiy for a late reply. I copied all files from c:\windows\fonts folder from my windows machine to a temporary directory of my solaris machine( i did not find any .TTC files.There were only .TTF files on my windows machine) .I added a call to setFontsFolder as shown below.After doing this, i was not even able to generate document on my AIX & Solaris machine.

public byte[] getMailMergedData(byte[] docTemplate, String inputXml) throws Exception{
    byte[] mailMergedDataAsByteArray = null;
    // Set fonts to be scanned for under the specified directory. Do not search within folders nested this folder.
    FontSettings.setFontsFolder("/mmsshare/j2ee/dev/iremarket_jboss/prashant/fonts/", false);
    //Aspose Part- input the DOT file
    Document doc = new Document(new ByteArrayInputStream(docTemplate));
    // Storing the xml input data file in memory.
    DocumentBuilder db = DocumentBuilderFactory.newInstance()
        .newDocumentBuilder();
    //Aspose-words needs xml doc as DOM Document object
    org.w3c.dom.Document xmlData = db.parse(
    new ByteArrayInputStream(inputXml.getBytes()));
    //Set the RemoveEmptyRegions to true in order to remove
    //un merged mail merge regions from the document.
    doc.getMailMerge().setRemoveEmptyRegions(true);
    //Executing Aspose mail merge engine
    doc.getMailMerge().executeWithRegions(
    new XmlMailMergeDataSet(xmlData));
    //Saving generated mail merged doc as mentioned save format
    ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
    doc.save(dstStream, SaveFormat.PDF);
    //Reading the final result into a Document object again
    mailMergedDataAsByteArray = dstStream.toByteArray();
    return mailMergedDataAsByteArray;
}

Can you pls advise?

Hi Prashant,

Thanks for your query. FontSettings class provides static methods that allow to specify the location of TrueType fonts that Aspose.Words will use when rendering documents to PDF, XPS, printing, imaging or embedding fonts into EPUB and other document formats that support embedded fonts.
Please make sure that font path is correct in setFontsFolder method. Please use the following code snippet in a separate test program. I have used this code and have not found any issue with check boxes. I have attached the output PDF file with this post. Please let me know if you still face problem.

// Open a template document.
Document doc = new Document("/home/Aspose/Inspection.dot");
// Set fonts to be scanned for under the specified directory. Do not search within sub-folders.
FontSettings.setFontsFolder("/home/Aspose/Font", false);
// Save the output document.
doc.save("/home/Aspose/AsposeOut-new.pdf");

The issues you have found earlier (filed as WORDSNET-7017) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.