pdfconverter

package module
v0.0.0-...-e76343e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 3 Imported by: 1

README

PDF Converter Library

Library untuk mengkonversi file PDF menjadi teks menggunakan perintah pdftotext.

Penggunaan

  1. Install poppler-utils
sudo apt-get install poppler-utils
  1. Install library ini dengan menambahkannya sebagai dependency pada file go.mod proyek Anda:
go get github.com/1amkaizen/pdfconverter
  1. Import library ini di proyek Anda:
import "github.com/1amkaizen/pdfconverter"
  1. Panggil fungsi ConvertPDFToText untuk mengkonversi file PDF menjadi teks:
pdfFilePath := "path/to/input.pdf"
outputFilePath := "path/to/output.txt"

err := pdfconverter.ConvertPDFToText(pdfFilePath, outputFilePath)
if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
}

fmt.Println("PDF berhasil diubah menjadi teks.")

Contoh Penggunaan

Berikut adalah contoh penggunaan library untuk mengkonversi file PDF menjadi teks:

package main

import (
	"fmt"
	"github.com/1amkaizen/pdfconverter"
)

func main() {
	pdfFilePath := "input.pdf"
	outputFilePath := "output.txt"

	err := pdfconverter.ConvertPDFToText(pdfFilePath, outputFilePath)
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return
	}

	fmt.Println("Konversi PDF selesai.")
}

Contoh lain
package main

import (
	"fmt"
	"os"
	"github.com/1amkaizen/pdfconverter" // Sesuaikan dengan path package yang sesuai
)

func main() {
	if len(os.Args) < 3 {
		fmt.Println("Usage: main inputPDFPath outputTextPath")
		return
	}

	inputPDFPath := os.Args[1]
	outputTextPath := os.Args[2]

	err := pdfconverter.ConvertPDFToText(inputPDFPath, outputTextPath)
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return
	}

	fmt.Println("PDF converted to text successfully.")
}

Untuk menjalankannya:

go run main.go input.pdf output.txt

Kontribusi

Jika Anda ingin berkontribusi pada proyek ini, silakan buka CONTRIBUTING.md untuk panduan kontribusi.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPDFToText

func ConvertPDFToText(inputPDFPath, outputTextPath string) error

ConvertPDFToText converts a PDF file to text.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL