2015-07-12 131 views
0

我正在創建一個PDF文件使用谷歌驅動器SDK但我得到一個錯誤,當文件創建..我不能下載文件。如何創建文件的PDF文件在谷歌驅動器SDK使用PHP

這是在創建PDF文件我的PHP代碼:

$subcontent = "<h1>Hello World</h1><p>text here of some</p>"; 
$file = new Google_DriveFile(); 

$file->setTitle($fileName); 

$file->setDescription($description); 

$mkFile = $this->_service->files->insert($file, array('data' => $subcontent, 'mimeType' => 'application/pdf')); 

該文件不能下載或打印.. enter image description here

文件也已在底部顯示一個錯誤說 Opps! There was a problem loading more pages enter image description here

任何人都可以在我的情況下幫助我嗎?我一直在努力在一個星期..在此先感謝,任何幫助將不勝感激..

回答

1

您似乎已假設雲端硬盤將您的HTML文件轉換爲PDF文件。 它不會

您可以做的是讓Drive將您的HTML轉換爲Google文檔,然後將該文檔導出爲PDF。將您的mime類型更改爲text/html並添加convert=true(請參閱庫文檔瞭解如何執行此操作)。

相關問題