Java?pdf文件書(shū)簽承前縮放驗(yàn)證的設(shè)置方法
1,什么是書(shū)簽承前縮放?
換句話來(lái)說(shuō)
設(shè)置了承前縮放,當(dāng)你手動(dòng)將page4縮放到145%,然后點(diǎn)擊書(shū)簽1,書(shū)簽1定位到的page1的縮放比例也是145%
2,如何設(shè)置書(shū)簽承前縮放?
使用工具:
承前縮放書(shū)簽設(shè)置:
其他類型書(shū)簽設(shè)置:
3,代碼
3.1 書(shū)簽結(jié)構(gòu):
3.2 代碼
import com.aspose.pdf.*; public class bookmark { public static void main(String[] args) { // Open document Document pdfDocument = new Document("D:\\chromeDownload\\測(cè)試版2.pdf"); OutlineCollection outlines = pdfDocument.getOutlines(); for (OutlineItemCollection outlineItem : (Iterable<OutlineItemCollection>) outlines) { double soureceZoom = -1; if (outlineItem.getDestination() != null) { soureceZoom = getAppointmentZoom(outlineItem.getDestination()); } else if (outlineItem.getAction() != null) { soureceZoom = getAppointmentZoom(outlineItem.getAction()); } if(soureceZoom == -1){ System.out.println("書(shū)簽必須承前縮放,書(shū)簽名:" + outlineItem.getTitle() + ",縮放因子: " + soureceZoom); // System.out.println("Title : " + outlineItem.getTitle() + ",縮放因子: " + soureceZoom); if (outlineItem.size()>0){ checkBookmark(outlineItem); } } private static void checkBookmark(OutlineItemCollection Outlines) { private static double getAppointmentZoom(IAppointment appointment) { if (appointment instanceof XYZExplicitDestination) { XYZExplicitDestination destination = (XYZExplicitDestination) appointment; return destination.getZoom(); } else if (appointment instanceof GoToAction) { GoToAction goToAction = (GoToAction) appointment; if (goToAction.getDestination() instanceof XYZExplicitDestination) { XYZExplicitDestination destination = (XYZExplicitDestination) goToAction.getDestination(); return destination.getZoom(); } else if (appointment instanceof GoToRemoteAction) { GoToRemoteAction goToRemoteAction = (GoToRemoteAction) appointment; if (goToRemoteAction.getDestination() instanceof XYZExplicitDestination) { XYZExplicitDestination destination = (XYZExplicitDestination) goToRemoteAction.getDestination(); return -1; }
3.3 控制臺(tái)輸出:
注意:承前縮放的因子為 0;
4,書(shū)簽的xml文件導(dǎo)出
4.1 代碼
import com.aspose.pdf.Document; import com.aspose.pdf.facades.PdfBookmarkEditor; import java.io.FileNotFoundException; public class AsposeTest { public static void main(String[] args) throws FileNotFoundException { Document document6 = new Document("D:\\測(cè)試版2.pdf"); exportBookmarksToXML(document6); } public static void exportBookmarksToXML(Document document) throws FileNotFoundException { PdfBookmarkEditor pdfBookmarkEditor = new PdfBookmarkEditor(); pdfBookmarkEditor.bindPdf(document); pdfBookmarkEditor.exportBookmarksToXML("D:\\測(cè)試版2.xml"); pdfBookmarkEditor.getDocument().save(); }
4.2 導(dǎo)出文件:
<?xml version="1.0" encoding="iso_8859_1"?> <Bookmark> <Title Open="True">目录縮放到頁(yè)面級(jí)別 <Title Page="2 XYZ 71 769 0" Action="GoTo" Open="True">3.2.S.7 稳定性承前縮放 <Title>3.2.S.7.1 稳定性总结</Title>實(shí)際大小 <Title Page="5 FitBH 842" Action="GoTo">3.2.S.7.2 上市后稳定性方案和稳定性承诺</Title>適合可見(jiàn) <Title Page="8 XYZ 71 523 0" Action="GoTo">3.2.S.7.3 稳定性数据</Title>承前縮放 </Title> </Title> <Title Page="1 XYZ 0 842 0" Action="GoTo" Open="False">表目录</Title>承前縮放 <Title Page="1 XYZ 0 842 0" Action="GoTo" Open="False">图目录</Title>承前縮放 </Bookmark>
aspose.pdf 官網(wǎng)指路 : https://docs.aspose.com/pdf/java/get-update-and-expand-bookmark/
到此這篇關(guān)于Java pdf文件書(shū)簽承前縮放驗(yàn)證的文章就介紹到這了,更多相關(guān)Java 書(shū)簽承前縮放驗(yàn)證內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Zookeeper連接超時(shí)問(wèn)題與拒絕連接的解決方案
今天小編就為大家分享一篇關(guān)于Zookeeper連接超時(shí)問(wèn)題與拒絕連接的解決方案,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-03-03java實(shí)現(xiàn)一致性hash算法實(shí)例代碼
這篇文章主要給大家介紹了關(guān)于java實(shí)現(xiàn)一致性hash算法的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12使用Java實(shí)現(xiàn)接口攔截器來(lái)監(jiān)控接口的執(zhí)行情況
在排查問(wèn)題的時(shí)候,由于沒(méi)有對(duì)接口的執(zhí)行情況,以及入?yún)⑦M(jìn)行監(jiān)控,所以排查起問(wèn)題就特別費(fèi)勁,今天我們就一起來(lái)寫(xiě)一個(gè)接口的攔截器來(lái)監(jiān)控接口的執(zhí)行情況吧2024-01-01Mybatis-Plus實(shí)體類注解方法與mapper層和service層的CRUD方法
CRUD是指在做計(jì)算處理時(shí)的增加(Create)、讀取查詢(Retrieve)、更新(Update)和刪除(Delete)幾個(gè)單詞的首字母簡(jiǎn)寫(xiě)。主要被用在描述軟件系統(tǒng)中DataBase或者持久層的基本操作功能,下面讓我們一起看看吧2022-03-03springboot集成mybatisplus實(shí)例詳解
這篇文章主要介紹了springboot集成mybatisplus實(shí)例詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-09-09Java Hibernate對(duì)象(瞬時(shí)態(tài),持久態(tài),脫管態(tài))詳解
這篇文章主要介紹了Java Hibernate對(duì)象(瞬時(shí)態(tài),持久態(tài),脫管態(tài))詳解的相關(guān)資料,這里對(duì)Java Hibernate對(duì)象進(jìn)行了介紹及總結(jié),需要的朋友可以參考下2016-11-11Java 如何從spring容器中獲取注入的bean對(duì)象
這篇文章主要介紹了Java 如何從spring容器中獲取注入的bean對(duì)象,幫助大家更好的理解和使用Java,感興趣的朋友可以了解下2020-11-11Arthas-java程序運(yùn)行時(shí)debug工具使用
這篇文章主要介紹了Arthas-java程序運(yùn)行時(shí)debug工具使用,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-11-11