Home > Backend Development > PHP Problem > What is the method to convert base64 to pdf in php?

What is the method to convert base64 to pdf in php?

hzc
Release: 2023-03-01 22:26:01
Original
4737 people have browsed it

How to convert base64 to pdf in php: first find the converted pdf file; then use the function "file_get_contents" to read the data; then use the function "base64_decode" to convert; finally use the function "file_put_contents" to write the data. Can.

What is the method to convert base64 to pdf in php?

/*
 * base64转pdf
 */function base642pdf($formTxt,$toPdf){
	$file = file_get_contents($formTxt);//读
    $data = base64_decode($file);//转换
	file_put_contents($toPdf, $data);//写}/*
 * pdf转base64
 */function pdf2base64($formPdf,$toTxt){
	$file = file_get_contents($formPdf);//读
    $data = base64_encode($file);//转换
	file_put_contents($toTxt, $data);//写}
Copy after login

Recommended tutorial: "php tutorial"

The above is the detailed content of What is the method to convert base64 to pdf in php?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template