PDF menyang MobiXML

Ngonversi PDF menyang MobiXML ing Jawa

PDF nawakake kaluwihan unik tinimbang format file liyane amarga bisa ngowahi alur kerja bisnis, dokumen resmi ing format sing njaga tata letak / format nalika dideleng ing platform apa wae. Iki njamin kabeh pamirsa ndeleng dokumen kaya sing dikarepake, ora preduli saka aplikasi asli, panampil, sistem operasi, utawa piranti sing digunakake. Nanging, MobiXML format panjelasan dhewe sing nuduhake eBook MobiXML Standard format lan didhukung meh kabeh e-maca modern khusus, piranti seluler karo bandwidth kurang. Dadi ing artikel iki, kita bakal njelajah rincian babagan Cara ngowahi PDF menyang MobiXML nggunakake REST API.

PDF Processing API

Kanggo ngolah file PDF kanthi program, kita wis nggawe solusi adhedhasar REST sing jenenge Aspose.PDF Cloud. Iki ngidini sampeyan nggawe, ngowahi, ngapusi lan ngowahi dokumen PDF dadi akeh format sing didhukung. Saiki kita butuh kemampuan konversi PDF ing aplikasi Java, mula kita kudu nambah referensi Aspose.PDF Cloud SDK for Java ing aplikasi Java kita kanthi nyakup rincian ing pom.xml (proyek jinis mbangun maven) .

<repositories> 
    <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>https://artifact.aspose.cloud/repo</url>
    </repository>   
</repositories>

<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-cloud-pdf</artifactId>
        <version>21.11.0</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

Sabanjure yaiku entuk kredensial klien saka Cloud Dashboard. Yen sampeyan durung ndhaptar, mangga ndhaftar nganggo alamat email sing bener lan njupuk kredensial pribadi sampeyan.

Konverter PDF menyang Mobi ing Jawa

Kanggo ngembangake konverter PDF menyang Mobi nggunakake Java, tututi pandhuan ing ngisor iki. Elinga yen langkah-langkah iki ngowahi dokumen PDF (dumunung ing panyimpenan Cloud) menyang format MOBIXML lan upload arsip ZIP asil menyang panyimpenan Cloud.

  • Gawe conto PdfApi ing ngendi kita menehi kredensial pribadi minangka argumen
  • Waca PDF input nggunakake conto File lan upload menyang panyimpenan maya nggunakake metode uploadFile(…) saka kelas PdfAPi
  • Nggawe obyek senar nyekeli jeneng kanggo asil file MobiXML
  • Pungkasan, nelpon metode putPdfInStorageToMobiXml(…) kanggo ngowahi PDF menyang Mobi online lan simpen output menyang panyimpenan awan
// kanggo conto liyane, bukak https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-java/tree/master/Examples/src/main/java/com/aspose/asposecloudpdf/examples

try
    {
    // Entuk ClientID lan ClientSecret saka https://dashboard.aspose.cloud/
    String clientId = "bbf94a2c-6d7e-4020-b4d2-b9809741374e";
    String clientSecret = "1c9379bb7d701c26cc87e741a29987bb";
  
    // nggawe conto PdfApi
    PdfApi pdfApi = new PdfApi(clientSecret,clientId);
		
    // jeneng input dokumen PDF
    String name = "input.pdf";
		        
    // maca isi file PDF input
    File file = new File("/Users/Downloads/"+name);
		
    // upload PDF menyang panyimpenan maya
    pdfApi.uploadFile("input.pdf", file, null);
  
    // jeneng berkas asil
    String resultantFile = "resultant.mobi";
		        
    // nelpon API kanggo PDF kanggo konversi MobiXML. File asil disimpen ing panyimpenan maya
    pdfApi.putPdfInStorageToMobiXml("input.pdf", resultantFile, null, null);
  
    // pesen sukses print
    System.out.println("PDF to Mobi conversion successful !");
    }catch(Exception ex)
    {
        System.out.println(ex);
    }

PDF menyang Mobi Kindle nggunakake Perintah cURL

Pilihan liyane kanggo ngakses API REST yaiku liwat perintah cURL. Dadi ing bagean iki, kita bakal ngowahi PDF menyang format Mobi Kindle nggunakake perintah cURL. Saiki minangka prasyarat, kita kudu nggawe token akses JWT dhisik (adhedhasar kredensial klien) nggunakake printah ing ngisor iki.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Saiki nglakokake printah ing ngisor iki sing ngemot file PDF saka panyimpenan Cloud lan nyimpen asil MobiXML menyang drive lokal.

curl -v -X GET "https://api.aspose.cloud/v3.0/pdf/input.pdf/convert/mobixml" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-o "Resultant.mobi"

Tip cepet

Kanggo ndeleng file Mobi kanthi online, coba gunakake [Tampilake Mobi Gratis] (https://products.groupdocs.app/viewer/mobi).

Kesimpulan

Kita wis ngliwati kabeh langkah sing dibutuhake kanggo nggunakake REST API kanggo ngowahi PDF dadi format Mobi (MobiXML). Sampeyan bisa uga wis mirsani sing proses lengkap wis prasaja lan langsung. Sampeyan bisa ngowahi siji PDF utawa nindakake pangolahan batch marang pirang-pirang file PDF. Disaranake sampeyan njelajah Dokumentasi Produk sing ngemot informasi babagan kabeh fitur menarik sing saiki didhukung dening API.

Yen sampeyan pengin entuk akses menyang kode sumber Cloud SDK, kasedhiya ing GitHub (diterbitake ing lisensi MIT). Pungkasan, yen sampeyan nemoni masalah nalika nggunakake API, hubungi kita liwat [Forum Dhukungan Produk] gratis 9.

Artikel sing gegandhengan

Mangga bukak link ing ngisor iki kanggo mangerteni sing luwih lengkap babagan: