Hi,
I’m testing Aspose.Pdf for C++ 2020.12
Found three problems:
- Do not deal with orientation in exif. (Test file 1)
- Do not support frames of images. (Test file 2)
- Do not support old style tiff (Test file 2)
- Error message:
System::ArgumentException: __cdecl System::Drawing::Bitmap::Bitmap(const class System::SmartPtr<class System::IO::Stream> &,bool)
- Error message:
Here is my test code
void imageToPdf() {
auto doc = System::MakeObject<Aspose::Pdf::Document>();
auto page = doc->get_Pages()->Add();
// 无法自动根据exif信息旋转图片
System::String fileName = System::String(u"F:\\Users\\zhuying\\Desktop\\自带旋转的图片.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");
}
Test files:
- 0024-WS·2019-D30-DTS-0001.jpg压缩模式.tif.zip (1.9 MB)
- 自带旋转的图片.zip (2.8 MB)