Kompres DOC ing Go SDK

Ngurangi ukuran DOC nggunakake Go

Nggunakake REST API ing Go, pangembang bisa ngompres DOC kanthi program. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.

Ndeleng potongan kode

Compress DOC ing Go

Nggunakake Go API sing kuat, pangembang bisa ngompres DOC kanggo ngoptimalake isi 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 DOC asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.

Ngurangi ukuran DOC file ing Go

Kaya sing wis kasebut, SDK Go kita ngidini sampeyan nyuda ukuran DOC kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres DOC ing Go kanthi conto ing ngisor iki:

Unggah file sing pengin dioptimalake / kompres
Kode roto
Pilih format target saka dhaptar
import (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input.doc")
requestCompressOptions := models.CompressOptions{
    ImagesQuality: ToInt32Pointer(int32(75)),
    ImagesReduceSizeFactor: ToInt32Pointer(int32(1)),
}
compressDocumentOnlineOptions := map[string]interface{}{}
compressDocumentRequest := &models.CompressDocumentOnlineRequest{
    Document: requestDocument,
    CompressOptions: &requestCompressOptions,
    Optionals: compressDocumentOnlineOptions,
}
compressDocument = wordsApi.CompressDocumentOnline(ctx, compressDocumentRequest)

convertDocumentOptions := map[string]interface{}{}
convertDocument := &models.ConvertDocumentRequest{
    Document: compressDocument.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertDocumentOptions,
}
_, _ = wordsApi.ConvertDocument(ctx, convertDocument)
Kode roto
  
Nyalin kode Go menyang clipboard

Carane ngompres DOC ing Go

  1. Pasang Aspose.Words Cloud for Go
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Go sampeyan
  3. Konfigurasi API nggunakake tombol app
  4. Muat sumber DOC kanggo ngompres
  5. Kompres DOC, ngresiki informasi sing ora digunakake
  6. Pilih format file output
  7. Entuk asil kompresi DOC minangka file sing kapisah

Pustaka Go kanggo nggunakake kompresi DOC.

Run go get -v github.com/aspose-words-cloud/aspose-words-cloud-go/2007/api kanggo nginstal Aspose.Words Cloud SDK for Go. Sampeyan bisa entuk akeh informasi migunani babagan cara instalasi liyane saka bagean "How to use SDK".

Klone Aspose.Words Cloud SDK for Go saka GitHub lan gunakake ing proyek sampeyan. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.

Requirements Sistem

Deleng Repository Documentation kanggo ndeleng rincian.

Format file liyane sing didhukung

Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.