Hello,
When trying to save a Word document (docx template) with Aspose Words to a PDF document , the custom properties set on the Word document are lost. Is this a known bug or is this not implemented?
I have attached two documents, a docx and a pdf generated with the understanding code snippit. This docx document contains the custom properties but the pdf document doen not contain them.
Regards Rob Sessink
Test environment:
OS Windows XP
Java JDK 1.5.0_14
Aspose Words 10.4.0 jdk5
@Test
public void testAddBuiltInAndCustomProperty() throws Exception {
CustomDocumentProperties cProperties = doc
.getCustomDocumentProperties();
cProperties.add("custom:date", getTransDate().getTime());
cProperties.add("custom:status", "ordered");
BuiltInDocumentProperties bProperties = doc
.getBuiltInDocumentProperties();
Calendar cal = getDate();
bProperties.setCreatedTime(cal.getTime());
bProperties.setLastPrinted(cal.getTime());
bProperties.setLastSavedTime(cal.getTime());
bProperties.setAuthor("tenbrinke");
File merged = new File(AsposeDocworksObjectMother.getPathToTargetDir(),
"builtinandcustom_property.docx");
doc.save(merged.getAbsolutePath(), SaveFormat.DOCX);
merged = new File(AsposeDocworksObjectMother.getPathToTargetDir(),
"builtinandcustom_property.pdf");
doc.save(merged.getAbsolutePath(),SaveFormat.PDF);
}
Hi Sessink,
Thanks for your query. In Microsoft Word, there is no way to export Custom Document Properties to PDF so Aspose.Words does the same.
Hello Manzoor,
does Aspose Words always tries to mimic the exact behaviour of Microsoft Word. In my view this behaviour would be a enhancement to Aspose and benificial for the userbase. Could this be made into a feature request? Is there another way to add custom metadata to the (generated) PDF, if not with Aspose Words, maybe via Aspose PDF?
Regards Rob
Hi Rob,
I think, it is not possible to add custom properties by using Aspose.PDF. However, I am moving this thread to Aspose.PDF forum and my colleagues will update you shortly with exact information.
Hi Rob,
Sorry for replying you late. I am a representative from Aspose.Pdf team.
I am pleased to share that Aspose.Pdf for .NET supports the feature to add custom information to the PDF file. Please visit the following link for more information on
However concerning to your query ‘When trying to save a Word document (docx template) with Aspose Words to a PDF document , the custom properties set on the Word document are lost.’ I am moving this thread to respective forum where I believe our team of experts taking care of this product would be in better position to answer this query. Please be patient and spare us little time. We are really sorry for this inconvenience.
Hi Rob,
Thanks for your inquiry. I would like to supplement Nayyer’s answer here i.e. during converting Word document to PDF, properties like Title, Author, Subject should be preserved, but if your Word document contains custom properties, these properties might be lost because there is no way to store custom document properties in PDF. These custom document properties are not exported upon converting Word document to PDF.
Please let us know if you need more information, We are always glad to help you.
Best Regards,
Hello,
Thanks for the explanation around the preservation of basic properties. In contrary to your statement, PDF has the option the set custom document properties/metadata. I have tested this with Adobe Writer. As a workaround I now use Apache PDF Box in the application to set the custom properties in the PDF after the generation by Aspose. However i would rather have this functionality directly in Aspose.
Regards Rob
Hi there,
Thanks for your inquiry.
Regarding Aspose.Words, we will consider exporting custom document properties to PDF as metadata sometime in the future. We will keep you informed of any developments.
Thanks,
The issues you have found earlier (filed as WORDSNET-5690) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.(4)
Hey support,
>>> The issues you have found earlier (filed as WORDSNET-5690) have been fixed in this .NET update and this Java update.
I’m using Aspose.Words 11.3 and I cannot see the custom properties in the generated PDF? Is this a regression or the 5690 fix above is not refering to this?
Regards,
Dragos
Hi
Thanks for your request. To export custom properties you should set ExportCustomPropertiesAsMetadata
option:
Document doc = new Document(@"TestCustomProperties.docx");
doc.CustomDocumentProperties.Add("prop1", true);
doc.CustomDocumentProperties.Add("prop2", 10);
PdfSaveOptions options = new PdfSaveOptions();
options.ExportCustomPropertiesAsMetadata = true;
doc.Save(@"TestCustomProperties.pdf", options);
Hope this helps.
Best regards,
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan