jumbaeric / docverter
一个多功能的PHP包,用于各种格式文档之间的转换。
1.2.1
2024-06-06 02:31 UTC
Requires
- php: >=7.4
- ext-imagick: *
- dompdf/dompdf: ^1.0
- phpoffice/phpspreadsheet: ^1.15
- phpoffice/phpword: ^1.2.0
- spatie/image: ^1.7
- spatie/pdf-to-image: ^2.3
- spatie/pdf-to-text: ^1.52
- spatie/temporary-directory: ^1.0
This package is auto-updated.
Last update: 2024-09-06 03:00:34 UTC
README
Docverter是一个多功能的PHP包,用于各种格式文档之间的转换。无论您需要将RTF、PDF、HTML、文本、图像、Markdown、Excel或Word文档进行转换,该包都提供使用行业标准库的无缝功能。
安装
您可以通过Composer安装此包
composer require jumbaeric/docverter
用法
RTF转PDF转换
use DocVerter\RTF2PDFConverter; $rtfContent = file_get_contents('example.rtf'); $pdfFilePath = 'output.pdf'; $converter = new RTF2PDFConverter($rtfContent, $pdfFilePath); $converter->convert();
PDF转RTF转换
use DocVerter\PDF2RTFConverter; $pdfFilePath = 'example.pdf'; $rtfFilePath = 'output.rtf'; $converter = new PDF2RTFConverter($pdfFilePath, $rtfFilePath); $converter->convert();
HTML转PDF转换
use DocVerter\HTML2PDFConverter; $htmlContent = file_get_contents('example.html'); $pdfFilePath = 'output.pdf'; $converter = new HTML2PDFConverter($htmlContent, $pdfFilePath); $converter->convert();
PDF转HTML转换
use DocVerter\PDF2HTMLConverter; $pdfFilePath = 'example.pdf'; $htmlFilePath = 'output.html'; $converter = new PDF2HTMLConverter($pdfFilePath, $htmlFilePath); $converter->convert();
文本转PDF转换
use DocVerter\Text2PDFConverter; $textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; $pdfFilePath = 'output.pdf'; $converter = new Text2PDFConverter($textContent, $pdfFilePath); $converter->convert();
PDF转文本转换
use DocVerter\PDF2TextConverter; $pdfFilePath = 'example.pdf'; $textFilePath = 'output.txt'; $converter = new PDF2TextConverter($pdfFilePath, $textFilePath); $converter->convert();
图像转PDF转换
use DocVerter\Image2PDFConverter; $imagePath = 'example.jpg'; $pdfFilePath = 'output.pdf'; $converter = new Image2PDFConverter($imagePath, $pdfFilePath); $converter->convert();
PDF转图像转换
use DocVerter\PDF2ImageConverter; $pdfFilePath = 'example.pdf'; $imageFolderPath = 'output/'; $converter = new PDF2ImageConverter($pdfFilePath, $imageFolderPath); $converter->convert();
Markdown转PDF转换
use DocVerter\Markdown2PDFConverter; $markdownContent = file_get_contents('example.md'); $pdfFilePath = 'output.pdf'; $converter = new Markdown2PDFConverter($markdownContent, $pdfFilePath); $converter->convert();
PDF转Markdown转换
use DocVerter\PDF2MarkdownConverter; $pdfFilePath = 'example.pdf'; $markdownFilePath = 'output.md'; $converter = new PDF2MarkdownConverter($pdfFilePath, $markdownFilePath); $converter->convert();
Excel转PDF转换
use DocVerter\Excel2PDFConverter; $excelFilePath = 'example.xlsx'; $pdfFilePath = 'output.pdf'; $converter = new Excel2PDFConverter($excelFilePath, $pdfFilePath); $converter->convert();
PDF转Excel转换
use DocVerter\PDF2ExcelConverter; $pdfFilePath = 'example.pdf'; $excelFilePath = 'output.xlsx'; $converter = new PDF2ExcelConverter($pdfFilePath, $excelFilePath); $converter->convert();
Word转PDF转换
use DocVerter\Word2PDFConverter; $wordFilePath = 'example.docx'; $pdfFilePath = 'output.pdf'; $converter = new Word2PDFConverter($wordFilePath, $pdfFilePath); $converter->convert();
PDF转Word转换
use DocVerter\PDF2WordConverter; $pdfFilePath = 'example.pdf'; $wordFilePath = 'output.docx'; $converter = new PDF2WordConverter($pdfFilePath, $wordFilePath); $converter->convert();
功能
- 灵活转换:无缝地在RTF、PDF和HTML格式之间进行转换。
- 由行业标准库提供支持:利用Dompdf、PHPRtfLite、PhpSpreadsheet、PhpWord和其他库进行可靠的转换。
- 简单集成:通过Composer轻松集成到您的PHP项目中。
- 可自定义选项:根据需要轻松自定义PDF生成选项。
关键词和标签
- Docverter
- PHP RTF转PDF
- 富文本格式转PDF
- HTML转PDF
- PDF转HTML
- Dompdf
- PHPRtfLite
- RTF转换器
- HTML转换器
- PDF生成
- PHP包
- Composer包
- 文档转换
致谢
Dompdf - PDF生成库。 PHPRtfLite - RTF生成库。 PhpSpreadsheet - Excel生成库。 PhpWord - Word生成库。