Home  >  Article  >  Backend Development  >  How to convert base64 to pdf in php

How to convert base64 to pdf in php

hzc
hzcOriginal
2020-06-05 15:09:054159browse

How to convert base64 to pdf in php

How 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);//写}

Recommended tutorial: "PHP Tutorial"


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

Statement:
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