@Ankayjay
To preserve embedded PDFs from a Word document when converting it to a PDF using Aspose.Words, you can utilize the PdfSaveOptions
class. This class provides various options for saving documents in PDF format, including the handling of embedded objects.
Here’s a basic example of how to set up the conversion:
using Aspose.Words;
using Aspose.Words.Saving;
class Program
{
static void Main()
{
// Load the Word document
Document doc = new Document("path/to/your/document.docx");
// Create PdfSaveOptions and set the necessary options
PdfSaveOptions saveOptions = new PdfSaveOptions
{
// Ensure that embedded objects are preserved
EmbedFullFonts = true, // This is just an example; adjust as needed
// You can set other options as required
};
// Save the document as PDF
doc.Save("path/to/output/document.pdf", saveOptions);
}
}
In this example, the EmbedFullFonts
option is set to true, which ensures that all fonts are embedded in the PDF. While this does not directly address the preservation of embedded PDFs, it is important to ensure that all content is properly handled during the conversion process.
Unfortunately, the Aspose.Words library does not explicitly mention the preservation of embedded files like PDFs in the documentation. However, it is designed to handle various types of embedded objects, so it may work as expected in your case.
If you encounter issues where embedded PDFs are still not clickable or openable, consider checking the version of Aspose.Words you are using, as updates may include improvements in handling embedded objects. Additionally, you may want to explore the documentation for any specific settings related to embedded objects.
For documents located on SharePoint Online, ensure that you have the necessary permissions and that the file paths are correctly set up to access the documents.
If you need further assistance or specific examples, feel free to ask!
Sources:
[1]: Working with PdfSaveOptions.cs