Hi Aspose team,
I’m trying to convert a word document to PDF using aspose words as follows:
// Load the Word document
Aspose.Words.Document doc = new Aspose.Words.Document(dir + @"\TestPDF_07312025\WordTestFile.docm");
// Create and configure PDF save options
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions
{
SaveFormat = Aspose.Words.SaveFormat.Pdf,
// Optimize file size and preserve vector image quality
OptimizeOutput = true,
ImageCompression = PdfImageCompression.Auto, // Keep EMF as vector
// Downsampling off to preserve image resolution (especially vector)
DownsampleOptions = new DownsampleOptions
{
DownsampleImages = false // Do not rasterize EMF or downsample images
},
// Optional: Embed only used fonts (smaller size)
EmbedFullFonts = false,
// Optional: PDF/A compliance for archival and sometimes better size
Compliance = Aspose.Words.Saving.PdfCompliance.PdfA1b
};
// Save the document as PDF
doc.Save(dir + @"\TestPDF_07312025\PDFOutput.pdf", options);
When comparing the word file to the pdf output, I’m seeing some undesired difference:
- WordVSPdf1: The star symbols in the chart seem to have white background.
- WordVSPdf2: The star symbols are missing its brown borders.
Is this a result of a property I’m using or is this a bug?
Here are all the test files I’ve used:
TestPDF_07312025.zip (1.7 MB)
@JThomas98
It sounds like you’re experiencing rendering issues when converting your Word document to PDF using Aspose.Words. The specific problems with the star symbols in your chart—having a white background and missing brown borders—are likely related to how the graphics are processed during the conversion.
Cause: The rendering issues may stem from image compression settings, downsampling options, font embedding, or the PDF compliance level.
Solution: Here are several steps to troubleshoot and resolve these issues:
-
Check Image Compression Settings: Set the ImageCompression
property to PdfImageCompression.None
to preserve the original appearance of the images.
-
Adjust Downsampling Options: Experiment with the DownsampleOptions
. Allowing downsampling can sometimes improve rendering for complex graphics.
-
Font Embedding: Ensure that fonts used for the star symbols are embedded correctly in the PDF by setting EmbedFullFonts
to true
.
-
PDF Compliance Level: If your document does not require PDF/A compliance, switch to a standard PDF format by using PdfCompliance.Pdf15
instead of PdfA1b
.
-
Update Aspose.Words: Make sure you are using the latest version of Aspose.Words, as updates often include bug fixes and improvements related to rendering.
Next Steps: Here’s a modified version of your code snippet incorporating these suggestions:
// Load the Word document
Aspose.Words.Document doc = new Aspose.Words.Document(dir + @"\TestPDF_07312025\WordTestFile.docm");
// Create and configure PDF save options
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions
{
SaveFormat = Aspose.Words.SaveFormat.Pdf,
OptimizeOutput = true,
ImageCompression = PdfImageCompression.None, // Try None for better quality
DownsampleOptions = new DownsampleOptions
{
DownsampleImages = false // Keep this as is for vector quality
},
EmbedFullFonts = true, // Embed all fonts
Compliance = Aspose.Words.Saving.PdfCompliance.Pdf15 // Try standard PDF compliance
};
// Save the document as PDF
doc.Save(dir + @"\TestPDF_07312025\PDFOutput.pdf", options);
Try these adjustments and see if they resolve the rendering issues. If the problems persist, please provide more details about the specific content and formatting of the Word document, and we can further investigate. Let me know how it goes!
There is no such thing as
PdfImageCompression.None
I only see
PdfImageCompression.Auto
PdfImageCompression.Jpeg
Neither do I see Aspose.Words.Saving.PdfCompliance.Pdf15
@JThomas98 The problem occurs be cause PdfA1 compliance does not support transparency. Please consider using PdfA2 compliance instead:
Document doc = new Document(@"C:\Temp\in.docx");
PdfSaveOptions opt = new PdfSaveOptions();
opt.Compliance = PdfCompliance.PdfA2a;
doc.Save(@"C:\Temp\out.pdf", opt);
PdfA1 is obsolete: PDF/A-1 have significant limitations which are removed in PDF/A-2.
@alexey.noskov, thank you for the suggestion. I can confirm that the issue has been fixed by using the above code.
1 Like