> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mejik.web.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Office Documents to PDF Converter Commands

> Converting Office documents to pdf, supports docx, xlsx, pptx

### 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 with `sudo apt-get install libreoffice`. The command uses the `soffice` binary, which may be `libreoffice` on 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**

```bash theme={null}
php artisan pdf:convert-from \
--in=<path_or_url> \
--out=<destination_path> \
--filetype=<file_ext> \
[--disk=<disk_name>]
```

##### **Options**

* `--in`: The source document. Can be a local file path or a full URL.
* `--out`: The destination path for the output PDF. If `--disk` is not used, this is a local file path. If `--disk` is 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 Local**

```bash theme={null}
php artisan pdf:convert-from \
--in="storage/app/reports/AnnualReport.docx" \
--out="public/pdfs/AnnualReport.pdf" \
--filetype="docx"
```

**2. URL Input to S3/Minio Output**

```bash theme={null}
php artisan pdf:convert-from \
--in="https://company-files.com/quarterly.xlsx" \
--out="reports/2024/quarterly.pdf" \
--filetype="xlsx" \
--disk="minio"
```

***

### Bahasa 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 `PATH` sistem. Di Debian/Ubuntu, instal dengan `sudo apt-get install libreoffice`. Perintah ini menggunakan biner `soffice`, yang mungkin bernama `libreoffice` di 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**

```bash theme={null}
php artisan pdf:convert-from \
--in=<path_atau_url> \
--out=<path_tujuan> \
--filetype=<ekstensi_file> \
[--disk=<nama_disk>]
```

##### **Opsi**

* `--in`: Dokumen sumber. Bisa berupa path file lokal atau URL lengkap.
* `--out`: Path tujuan untuk file PDF output. Jika `--disk` tidak digunakan, ini adalah path file lokal. Jika `--disk` digunakan, 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.

##### **Contoh Penggunaan**

**1. Lokal ke Lokal**

```bash theme={null}
php artisan pdf:convert-from \
--in="storage/app/laporan/LaporanTahunan.docx" \
--out="public/pdfs/LaporanTahunan.pdf" \
--filetype="docx"
```

**2. Input URL ke Output S3/Minio**

```bash theme={null}
php artisan pdf:convert-from \
--in="https://file-perusahaan.com/kuartal.xlsx" \
--out="laporan/2024/kuartal.pdf" \
--filetype="xlsx" \
--disk="minio"
```
