XPS文件怎么打开

XP下需要下载 XPS Viewer

WIN7/WIN8自带不需要安装,但是可能会出现“内置管理员无法激活此应用”的错误,解决方法:

ctrl+R进入命令模式,输入gpedit.msc------》计算机配置---》安全设置--》本地策略---安全选项---》用户账号控制,用于内置管理员账户的管理员批准模式,启用后重启即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用java-axp解析XPS文件的步骤: 1.下载java-axp库并将其添加到项目中。 2.创建一个XPSDocument对象并将XPS文件作为参数传递给它。 3.使用XPSDocument对象获取FixedDocumentSequence对象。 4.使用FixedDocumentSequence对象获取FixedDocument对象。 5.使用FixedDocument对象获取FixedPage对象。 6.使用FixedPage对象获取所有的PageContent对象。 7.使用PageContent对象获取所有的Element对象。 8.遍历Element对象并获取其属性和内容。 以下是示例代码: ```java import java.io.File; import java.io.IOException; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.xmlgraphics.xps.XPSDocument; import org.apache.xmlgraphics.xps.XPSException; import org.apache.xmlgraphics.xps.XPSElement; import org.apache.xmlgraphics.xps.XPSPage; import org.apache.xmlgraphics.xps.XPSSharedStrings; import org.apache.xmlgraphics.xps.XPSText; import org.apache.xmlgraphics.xps.XPSTextRun; import org.apache.xmlgraphics.xps.XPSTypography; import org.apache.xmlgraphics.xps.XPSTypographyProperties; public class XPSParser { public static void main(String[] args) throws IOException, XPSException { File xpsFile = new File("example.xps"); byte[] xpsData = FileUtils.readFileToByteArray(xpsFile); XPSDocument xpsDoc = new XPSDocument(xpsData); List<XPSElement> elements = xpsDoc.getPage(0).getContent().getElements(); for (XPSElement element : elements) { if (element instanceof XPSText) { XPSText text = (XPSText) element; List<XPSTextRun> runs = text.getRuns(); for (XPSTextRun run : runs) { XPSTypography typography = run.getTypography(); XPSTypographyProperties properties = typography.getProperties(); String fontFamily = properties.getFontFamily(); int fontSize = properties.getFontSize(); String textContent = run.getText(); System.out.println("Font Family: " + fontFamily); System.out.println("Font Size: " + fontSize); System.out.println("Text Content: " + textContent); } } } } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值