您可以使用 Aspose.Total for Android Java 包的兩個 API 在您的移動應用程序中集成 EPUB 到 PS 的轉換功能。首先,您需要使用 Aspose.PDF for Android via Java 將 EPUB 文件轉換為 DOC。其次,通過使用文字處理 API Aspose.Words for Android via Java ,您可以將 DOC 渲染為 PS。
通過 Java 在 Android 上將 EPUB 轉換為 PS
轉換要求
您可以直接從 Maven 通過 Java 輕鬆使用 Aspose.Total for Android 和安裝 Aspose.PDF for Android via Java 和 Aspose.Words for Android via Java 在您的應用程序中。
或者,您可以從 下載 獲取 ZIP 文件。
// load EPUB file with an instance of Document class
Document document = new Document("template.epub");
// save EPUB as a DOC
document.save("DocOutput.doc", SaveFormat.DOC);
// load DOC with an instance of Document
Document outputDocument = new com.aspose.words.Document("DocOutput.doc");
// call save method while passing SaveFormat.PS
outputDocument.save("output.ps", SaveFormat.PS);
通過 Java 在 Android 上獲取 EPUB 文件信息
在將 EPUB 轉換為 PS 之前,您可能需要有關文檔的信息,包括作者、創建日期、關鍵字、修改日期、主題和標題。此信息有助於轉換過程的決策。使用強大的 Aspose.PDF for Android via Java API,您可以獲得所有內容。要獲取有關 EPUB 文件的文件特定信息,首先使用 getInfo 方法。一旦檢索到 DocumentInfo 對象,您就可以獲取各個屬性的值。
// load EPUB document
Document doc = new Document("template.epub");
// get document information
DocumentInfo docInfo = doc.getInfo();
// show document information
System.out.println("Author: " + docInfo.getAuthor());
System.out.println("Creation Date: " + docInfo.getCreationDate());
System.out.println("Keywords: " + docInfo.getKeywords());
System.out.println("Modify Date: " + docInfo.getModDate());
System.out.println("Subject: " + docInfo.getSubject());
System.out.println("Title: " + docInfo.getTitle());
通過 Java 在 Android 中的 PS 文檔中插入尾註
除了文檔轉換,您還可以使用 Aspose.Words for Android via Java API 在您的 Android 應用程序中添加許多其他功能。該功能之一是在 PS 文檔中插入尾註和編號。如果要在 PS 文檔中插入腳註或尾註,請使用 DocumentBuilder.InsertFootnote 方法。此方法在文檔中插入腳註或尾註。 EndnoteOptions 和 FootnoteOptions 類表示腳註和尾註的編號選項。
// load document
Document doc = new Document("input.DOC");
// initialize document builder
DocumentBuilder builder = new DocumentBuilder(doc);
// add text in it
builder.write("Some text");
// insert footnote
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote text.");
// initialize endnote options
EndnoteOptions option = doc.getEndnoteOptions();
// set restart rule
option.setRestartRule(FootnoteNumberingRule.RESTART_PAGE);
// set position
option.setPosition(EndnotePosition.END_OF_SECTION);
// save the document to disk.
doc.save("output.ps", SaveFormat.PS);
使用 Android 探索 EPUB 轉換選項
什麼是 EPUB 文件格式
EPUB 文件是一個打開的電子書文件。該格式由國際數字出版論壇 (IDPF) 開發,基於 XML 和 XHTML。 EPUB 文件可以在各種電子設備上閱讀,包括電子閱讀器、平板電腦和智能手機。 EPUB 文件通常由三個部分組成:1。書脊,其中包含本書的正文和閱讀頁面的順序。 2。一份清單,其中列出了構成本書的所有文件,包括書脊、封面圖像和任何其他內容。3。一個容器,以壓縮格式存儲文件。 EPUB 文件可以使用多種軟件程序創建,包括 Adobe InDesign、Sigil 和 Calibre。
什麼是 PS 文件格式
PS(PostScript)文件格式是由Adobe Systems 開發的一種頁面描述語言。它通常用於打印,並受到各種打印機和成像設備的支持。 PS 文件包含說明應如何在打印頁面上呈現文本、圖像和圖形等元素的說明。
PS 文件由生成 PostScript 輸出的應用程序創建,例如 Adobe Illustrator、Adobe InDesign 或其他圖形軟件。它們主要用於需要高質量和一致輸出的專業打印工作流程。
PS 文件格式基於基於堆棧的編程語言,其中命令和操作數放在堆棧上並執行以順序的方式。這允許精確控制頁面佈局、排版、顏色和其他打印參數。
PS 文件通常是基於文本的,可以使用文本編輯器打開和編輯。它們由一系列表示 PostScript 代碼的 ASCII 字符組成。該代碼描述了頁面上對象的排列和外觀,包括文本定位、圖像放置和圖形轉換。
雖然 PS 文件主要用於打印,但它們也可以轉換為其他格式以進行數字分發或進一步加工。例如,PS 文件可以轉換為 PDF(便攜式文檔格式)文件,這種文件受到廣泛支持,可以在各種設備上輕鬆查看和打印。