Hi,
I got this error
Aspose::Pdf::Engine::Presentation::Graphics::CoreExceptions::ImageException: Can't binarize image.
This is test image.
图片-9.jpg (12.5 KB)
Hi,
I got this error
Aspose::Pdf::Engine::Presentation::Graphics::CoreExceptions::ImageException: Can't binarize image.
This is test image.
图片-9.jpg (12.5 KB)
Could you please also share the complete sample code snippet with which you tried conversion? We will test the scenario in our environment and address it accordingly.
void imageToPdf() {
auto doc = System::MakeObject<Aspose::Pdf::Document>();
auto page = doc->get_Pages()->Add();
System::String fileName = System::String(u"F:\\xxx.jpg");
auto fileStream = System::MakeObject<System::IO::FileStream>(fileName, System::IO::FileMode::Open, System::IO::FileAccess::Read);
auto bmp = System::MakeObject<System::Drawing::Bitmap>(fileStream);
auto r = System::MakeObject<Aspose::Pdf::Rectangle>(0.0, 0.0, (double)bmp->get_Width(), (double)bmp->get_Height());
page->set_CropBox(r);
// 设置页面大小
auto pageInfo = page->get_PageInfo();
pageInfo->get_Margin()->set_Bottom(0);
pageInfo->get_Margin()->set_Top(0);
pageInfo->get_Margin()->set_Left(0);
pageInfo->get_Margin()->set_Right(0);
page->SetPageSize(r->get_Width(), r->get_Height());
page->AddImage(fileStream, r);
fileStream->Close();
doc->Save(u"imageToPdf.pdf");
}
We have logged an issue as PDFCPP-1555 in our issue tracking system for further investigation on this case. We will look into ticket details and keep you posted with the status of its resolution. Please be patient and spare us some time.
We are sorry for the inconvenience.