I am converting some word document to pdf using Aspose for Word.
In the word document there are some system field defined, such as PrintDate and SaveDate.
When i convert the doc to PDF the PrintDate is changed to today’s date instead of maintaining original date in the document.ReferenceDoclet_withSingleCell.zip (22 Bytes)
Is there any way to prevent that from happening when converting?
Thanks a lot,
Kevin
130138923.zip (92.2 KB)
this document has the PrintDate in the first page.
@kshengivari,
You can lock PRINTDATE fields in Word document and then convert to PDF by using the following C# code of Aspose.Words for .NET:
Document doc = new Document(@"C:\Temp\130138923\130138923.doc");
foreach (Field field in doc.Range.Fields)
if (field.Type.Equals(FieldType.FieldPrintDate))
field.IsLocked = true;
doc.Save(@"C:\Temp\130138923\20.11-IsLocked.pdf");
Thank you @awais.hafeez, do you have Java version of the code?
thanks,
Kevin
@kshengivari,
Java equivalent of above code is as follows:
Document doc = new Document("C:\\Temp\\130138923\\130138923.doc");
for (Field field : doc.getRange().getFields())
if (field.getType() == FieldType.FIELD_PRINT_DATE)
field.isLocked(true);
doc.save("C:\\Temp\\130138923\\awjava-20.11-IsLocked.pdf");
thank you very much. It works.