We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove Virus during Word DOCX to PDF Conversion | Java

We have PDF files generated by the Aspose.word library (after merged data and DOCX template).
However, our vendor rejected our PDF and said our PDF may contain virus.

The following is the code fragment:

          private val pdfSaveOptions = PdfSaveOptions().apply {
             fontEmbeddingMode = EMBED_ALL
             compliance = PDF_A_1_B
          val document = com.aspose.words.Document(wordDocument.contentStream())
          document.save(outputStream, pdfSaveOptions)

I tried to use Document.removeMacros, however, in debugger, I noticed it can’t solve the issue as most of the fields are already same as what removeMacros does.

I suspect it may due to some unknown metadata in the PDF.
Do you have similar incidence before?


Please upgrade to the latest (21.8) version of Aspose.Words for Java and see how it goes on your end? In case the problem still remains, then please compress the following resources into ZIP format and attach the .zip file here for testing:

  • Your simplified template Word document
  • Aspose.Words 21.8 generated PDF file showing the undesired behavior
  • Please also create a standalone simplified Java Application (source code without compilation errors) that helps us to reproduce this issue on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the ZIP file size.
  • What antivirus software are you using to check for viruses in Aspose.Words generated PDF files and from where can we get it for testing on our end?

As soon as you get these pieces of information ready, we will then start investigation into your issue and provide you more information.