1 使用转换工具将《PPT转H5系列(六)----提取PPT中使用的字体文件》中PPT转换后的pdf文件转换成xml文件
转换工具:mudraw.exe
命令示例如下:./mudraw.exe -F stext "C:\Users\user\AppData\Local\Temp\HTML5Point\default.pdf"
解析出来的xml然后用tinyxml2进行解析,得出每一页的使用的字体信息
void MuxmlReader::OpenFromString(const std::string& xml)
{
try
{
tinyxml2::XMLDocument doc;
if(doc.Parse(xml.c_str()) == tinyxml2::XML_SUCCESS)
{
tinyxml2::XMLElement* element = doc.RootElement();
this->m_document.DeSerial(element);
this->State = MuxmlReader::MuxmlReaderState_Loaded;
}
else
{
this->State = MuxmlReader::MuxmlReaderState_Invalid;
}
}
catch(...)
{
this->State = MuxmlReader::MuxmlReaderState_Invalid;
}
}
然后遍历节点,获取使用的字体信息并保存