English Documentation
Overview
This is a utility command that converts a wide variety of office documents (e.g.,.docx, .xlsx, .odt) into a PDF file. It uses the LibreOffice suite in headless (server) mode to perform the conversion. The command is designed to work in a cloud environment, supporting inputs from URLs and outputs to S3-compatible storage.
Prerequisites
- LibreOffice: Must be installed on the server and accessible via the system
PATH. On Debian/Ubuntu, install withsudo apt-get install libreoffice. The command uses thesofficebinary, which may belibreofficeon some systems; you may need to edit the script if necessary. - S3/Minio Driver (for remote output):
composer require league/flysystem-aws-s3-v3 "^3.0"
Command Usage
Syntax
Options
--in: The source document. Can be a local file path or a full URL.--out: The destination path for the output PDF. If--diskis not used, this is a local file path. If--diskis used, this is the path within that disk’s bucket.--filetype: The file extension of the input file (e.g.,docx,xlsx). This is a hint for the conversion process.--disk: (Optional) The name of the Laravel filesystem disk to use for output.
Example Usage
1. Local to LocalBahasa Indonesia Documentation
Gambaran Umum
Ini adalah perintah utilitas yang mengonversi berbagai jenis dokumen office (misalnya,.docx, .xlsx, .odt) menjadi file PDF. Perintah ini menggunakan LibreOffice suite dalam mode headless (server) untuk melakukan konversi. Perintah ini dirancang untuk bekerja di lingkungan cloud, mendukung input dari URL dan output ke penyimpanan yang kompatibel dengan S3.
Prasyarat
- LibreOffice: Harus terinstal di server dan dapat diakses melalui
PATHsistem. Di Debian/Ubuntu, instal dengansudo apt-get install libreoffice. Perintah ini menggunakan binersoffice, yang mungkin bernamalibreofficedi beberapa sistem; Anda mungkin perlu mengedit skrip jika diperlukan. - Driver S3/Minio (untuk output jarak jauh):
composer require league/flysystem-aws-s3-v3 "^3.0"
Penggunaan Perintah
Sintaks
Opsi
--in: Dokumen sumber. Bisa berupa path file lokal atau URL lengkap.--out: Path tujuan untuk file PDF output. Jika--disktidak digunakan, ini adalah path file lokal. Jika--diskdigunakan, ini adalah path di dalam bucket disk tersebut.--filetype: Ekstensi file dari file input (misalnya,docx,xlsx). Ini adalah petunjuk untuk proses konversi.--disk: (Opsional) Nama disk filesystem Laravel yang akan digunakan untuk output.
