bool annot_has_outerbox = true;
auto boundary = apparence->GetAttribute(L"Boundary");
if (boundary.GetStringLength() <= 0) {
boundary = elem->GetAttribute(L"Boundary");
if (boundary.GetStringLength() <= 0) {
annot_has_outerbox = false;
//查找最大的boundary
boundary = findBiggestBoundary(apparence);
}
}
{
using absl::ByAnyChar;
using absl::SkipWhitespace;
std::vector<std::string> v =
absl::StrSplit(boundary.ToDefANSI().c_str(),
ByAnyChar(" \t\n\r"), SkipWhitespace());
if (v.size() == 4) {
ebbox.left = ofd_mm_to_one_72_point(StringToFloat(v[0].c_str()));
ebbox.top = ofd_mm_to_one_72_point(StringToFloat(v[1].c_str()));
ebbox.width =
ofd_mm_to_one_72_point(StringToFloat(v[2].c_str()));
ebbox.height =
ofd_mm_to_one_72_point(StringToFloat(v[3].c_str()));
}
}
ebbox = page_ctm.TransformRect(ebbox);
annot_obj->SetPageBBOX(ebbox);//这里是取一个最大的框来做批注的外框。
annot_obj->SetPageCTM(&page_ctm);
if (annot_has_outerbox) {
auto annot_page_ctm = page_ctm;
annot_page_ctm.e += ebbox.Left();
annot_page_ctm.f += ebbox.Top();
annot_obj->SetPageCTM(&annot_page_ctm);//有外框的时候,调整e,f来匹配内部的相对坐标
}
标签:批注,ofd,annot,page,非标准,ctm,boundary,ebbox From: https://www.cnblogs.com/xiloureader/p/17880230.html