Nggunakake REST API ing Java, pangembang bisa ngompres dokumen ing DOC, DOCX, RTF, PDF, lan format liyane. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.
Nggunakake Java API sing kuat, pangembang bisa ngompres file kanggo ngoptimalake konten lan ukuran file output. Ngurangi ukuran file dumadi kanthi ngresiki data lan sumber daya sing ora digunakake. Sampeyan uga bisa compress gambar kanggo nggawe ukuran file output malah luwih cilik.
Asil optimasi lan kompresi isi bisa disimpen ing format file asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.
Kaya sing wis kasebut, SDK Java kita ngidini sampeyan nyuda ukuran dokumen kanthi program ing format apa wae sing didhukung. Contone, sampeyan bisa nyuda ukuran PDF file, DOCX, DOC, RTF, ODT, EPUB, HTML lan format liyane. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres dokumen ing Java kanthi conto ing ngisor iki:
import com.aspose.words.cloud.*;
ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);
byte[] requestDocument = Files.readAllBytes(Paths.get("Input.docx").toAbsolutePath());
CompressOptions requestCompressOptions = new CompressOptions();
requestCompressOptions.setImagesQuality(75);
requestCompressOptions.setImagesReduceSizeFactor(1);
CompressDocumentOnlineRequest compressDocumentRequest = new CompressDocumentOnlineRequest(
requestDocument, requestCompressOptions, null, null, null, null);
CompressDocumentOnline compressDocument =
wordsApi.compressDocumentOnline(compressDocumentRequest);
ConvertDocumentRequest convertDocument = new ConvertDocumentRequest(
compressDocument.getDocument().iterator().next(), "docx", null, null, null, null);
wordsApi.convertDocument(convertDocument);
Instal 'Aspose.Words Cloud SDK for Java' nggunakake alat otomatisasi mbangun Maven.
Tambah ketergantungan iki menyang POM proyek sampeyan:
Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Java saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Deleng Repository Documentation kanggo ndeleng rincian.