Hi,
We have been working with Aspose.Slides.Cpp since version 24. We also have purchased the license. Recently we have upgraded the Aspose.Slides.Cpp to version 25.6(latest) and found out that our emf with table annotation doesn’t print properly onto PDF through Aspose.Slides. For last empty cells the border overflow the height of EMF.
I have attached the sample EMF and output image.
Sample-Table-OutPut-PDF-Screenshot.png (8.7 KB)
Sample-Table.zip (1.7 KB)
Would request to resolve this as soon as possible. We are using following code to print it onto slides :
System::String emfPath(std::string(strEMFile).c_str());
auto emfImage = pImpl->presentation->get_Images()->AddImage(System::IO::File::ReadAllBytes(emfPath));
System::SharedPtr<Aspose::Slides::IPictureFrame> picFrame = slide->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, fXPos, fYPos, fWidth, fHeight, emfImage);
@ashvek.gaonkar
It sounds like you’re experiencing an issue with EMF files when converting to PDF using Aspose.Slides.Cpp, particularly with table annotations where the borders overflow the height of the EMF in the last empty cells.
Cause: This issue may arise due to compatibility problems with the EMF file format or incorrect handling of dimensions in your code.
Solution: Here are several steps to troubleshoot and resolve this issue:
-
Check EMF File Compatibility: Ensure that the EMF file you are using is compatible with the latest version of Aspose.Slides. Specific features or formats in EMF files may not be fully supported.
-
Update Your Code: Make sure your code is correctly handling the EMF file. Adjust the dimensions of the PictureFrame
to ensure it fits the content properly. Here’s a sample code snippet to ensure the dimensions are set correctly:
System::String emfPath(std::string(strEMFile).c_str());
auto emfImage = pImpl->presentation->get_Images()->AddImage(System::IO::File::ReadAllBytes(emfPath));
System::SharedPtr<Aspose::Slides::IPictureFrame> picFrame = slide->get_Shapes()->AddPictureFrame(
Aspose::Slides::ShapeType::Rectangle, fXPos, fYPos, fWidth, fHeight, emfImage);
-
Adjust EMF Rendering Settings: If the issue persists, consider adjusting the rendering settings for EMF files. Explore the properties of the PictureFrame
or the EMF image to see if there are any settings that can help with the overflow issue.
-
Test with Different EMF Files: Try using different EMF files to determine if the problem is specific to the one you are currently using. This can help identify if the issue lies with the file itself or the conversion process.
-
Contact Support: If none of the above steps resolve the issue, reach out to Aspose support with the specific EMF file and the output PDF for further assistance.
Next Steps: Implement the suggested troubleshooting steps and test the results. If the problem persists, gather the necessary files and details to contact Aspose support.
Please let me know if this helps or if you have any further questions!
I have attached the sample Files. Please connect with aspose.Slides support
@ashvek.gaonkar,
Thank you for contacting free support. With Aspose.Slides for C++ 25.6, I used the following code example:
auto presentation = MakeObject<Presentation>();
auto emfBytes = File::ReadAllBytes(u"Sample-Table.emf");
auto emfImage = presentation->get_Images()->AddImage(emfBytes);
auto slide = presentation->get_Slide(0);
auto pictureFrame = slide->get_Shapes()->AddPictureFrame(
ShapeType::Rectangle, 20, 20, 400, 150, emfImage);
presentation->Save(u"output.pptx", SaveFormat::Pptx);
presentation->Save(u"output.pdf", SaveFormat::Pdf);
presentation->Dispose();
My result looks fine: output.zip (47.3 KB)
Could you please review the issue carefully once more?
Thank You for the reply, We have pdfOptions->set_SaveMetafilesAsPng(false); to have vector image in PDF while saving. As the output you shared seems to have raster EMF image in PDF. Could you please try with PdfOptions?
auto pdfOptions = System::MakeObject<Aspose::Slides::Export::PdfOptions>();
pdfOptions->set_SaveMetafilesAsPng(false);
if (!pdfPath.empty()) {
pImpl->presentation->Save(StringtoU16(pdfPath.c_str()).c_str(), Aspose::Slides::Export::SaveFormat::Pdf, pdfOptions);
status = true;
}
Regards,
@ashvek.gaonkar,
Thank you for the additional information. I’ve reproduced the problem where the table in the EMF image is displayed incorrectly when converting a presentation with the specified options to PDF.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESCPP-4050
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.