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.
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:
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)
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.
Deleng Repository Documentation kanggo ndeleng rincian.
Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane: