Free Support Forum - aspose.com

Aspose modifying ORIGINAL Word document with trail license text and cutting it off

We have been using Aspose.Words for quite some time now and we had a situation where we accidentially ended up with a trial license in one of our applications. We didn’t think this would be that big of an issue, seeing as we could just replace the license and then re-run the .word document to create the .pdf, but instead of just adding the “Trial version” text to the .pdf, it modified our original word document and saved the “Trial version” text to it. The only real problem with this is that if the document is longer than around ten pages, the service will CUT OFF the document at ten pages and leave a message at the bottom saying “This document has been truncated due to use of a trial license” and then SAVE the original word document and run the service to create the .pdf.


So basically, we lost many pages of document because we accidentally placed a trial license file in the folder… Is there anything you can do about this issue? Obviously not returning our documents, but fixing the fact that this program is allowed to delete parts of our original files?

Thank you for your help.

Hi Naren,


Thanks for your inquiry and sorry for the delayed response. These problems are occurring because your trial license has expired and you’re using Aspose.Words in evaluation mode. There is an evaluation limitation of maximum number of paragraphs in the document which truncates your document at the end . Please read the following article for more details:
http://www.aspose.com/docs/display/wordsnet/Evaluate+Aspose.Words

Please let us know if you need more information, we are always glad to help you.

Best Regards,

We understand that we ended up with a trial license. But the issue is that the application deleted parts of our clients documents. For example, the client uploads a document that is ten pages, then they run the pdf convertor. The issue here is that your application will delete part of the ORIGINAL document. This meaning the client loses part of their original document that they can never get back.


Does this make more sense? You have the reason to truncate the created pdf document, but there is no reason it should delete part of the original copy of the document.

This is becoming a large issue for us, can you please make this a priority issue in your next release?

Another issue is if the license file is missing from the directory it will also produce this trial license error and cut off the policy.


An accident like this can happen any time and we want to ensure that our clients documents are protected.
Hi Naren,

Thanks for your inquiry.

There is no built-in method to check whether the license is already applied or not. However, if you want to be sure, you can try creating your own custom method to do this job. To do this you could create a blank document and export this to a stream. Then reload this and check the first paragraph in the body for the evaluation message.

///

/// Returns true if the Aspsoe.Words license is set.

///

private static bool IsLicenseSet()

{

// We will insert this text at the beggining of the document.

// If the license set this text will be in th efirt paragraph,

// if not an evaluation watermark will be in the first paragraph.

const string text = "This is text used to check if the license is set";

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write(text);

// Save and open the document. If Aspose.Words works in evaluation mode it will add a watermark.

using (MemoryStream docStream = new MemoryStream())

{

doc.Save(docStream, SaveFormat.Doc);

docStream.Position = 0;

doc = new Document(docStream);

}

// Check text of the first paragraph.

return (doc.FirstSection.Body.FirstParagraph.ToTxt().Trim() == text);

}

I hope, this helps.

Best regards,

Hi Naren,


Are you by any chance modifying/saving the original document yourself?

I made a 30-page document filled with random text, then ran this code on it (with only a trial license):

com.aspose.words.Document d = new com.aspose.words.Document(“longDocument.docx”);
d.save(“longDocumentSaved.docx”);

longDocument.docx stayed exactly as it was to start with.
longDocumentSaved.docx had the “evaluation” message at the top, and the “truncated” message at the end of page 27.
Hi Alex,

Thanks for the additional information. Yes, the evaluation version of Aspose.Words (without a license specified) provides full product functionality, but it inserts an evaluation watermark at the top of the document on open and save, and limits the maximum document size to several hundred paragraphs.

Best regards,