save pdf file in a folder using mPDF - pdf

I am using mPDF to generate pdfs. I want to know, how to save that file to a particular folder path. I am using this code to save the file :
$path = "sites/default/files/diet_plans/diet_plan.pdf";
$mpdf = new mPDF();
$mpdf->WriteHTML('<p>Hello</p>');
$mpdf->Output($path, "F");
exit;
But this piece of code returns an error like this :
mPDF error: Unable to create output file: sites/default/files/diet_plans/diet_plan.pdf

I have found that mPDF can not create directories. I have been using Rules to create the directory first and then execute the mPDF action. Make sure that the Directory diet_plans exists

Related

How to configure doxyfile and get documentation for .doc file as input to generate html output in Doxygen?

I have a task of documenting a file with extension .doc using doxygen tool. I am able to generate html output for a .cpp file but stuck to set the correct configuration of doxyfile to generate html output for file with .doc extension as input file .Please help me out to solve this problem.
I tried the above mentioned to document a doc file but it failed should Is it necessary to comment the contents in doc file to get html output or it's ok if we just parse the file by mentioning FILE_PATTERNS =*.doc

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

Rename files without extension with AutoHotkey

I am trying to add .pdf to the filename of files without extension in a folder.
It is possible to rename for example txt files to pdf using the following command:
FileMove, %SourceFolder%\*.txt, %SourceFolder%\*.pdf
Also, I can add .pdf to all files by:
FileMove, %SourceFolder%\*, %SourceFolder%\*.pdf
But I only want to target only the files without extension. How to do this?
Example
As suggested by kasper and MCL
SetWorkingDir %A_ScriptDir%
Loop, files\*
{
if !StrLen(A_LoopFileExt) ; if no file extension
{
FileMove,%A_LoopFileFullPath%,%A_LoopFileFullPath%.pdf ;rename file
}
}
see [Loop, FilePattern]
see [FileMove]
#kasper, You can use windows command prompt to rename the file as well as change the extension.
Just navigate to the file directory and use command
ren abc.txt abc.pdf
Here abc.txt is old file and abc.pdf is pdf of abc.txt.

File upload in specific folder of web application in liferay..?

I am using liferay 6.0.5. I am uploading file using following code.
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
String submissionFileName = uploadRequest.getFileName("file");//uploaded filename
File submissionFile = uploadRequest.getFile("file");
this works fine and upload file in tomcat's temp directory with some different name. What I want is.."There is one folder docs in my project directory. I want uploaded file in this directory". How to do this in liferay..?
If you want to change the temp directory for the file upload then you can change the following property in portal-ext.properties:
com.liferay.portal.upload.UploadServletRequestImpl.temp.dir=C:/MyTempDir
Hope this is what you are looking for.
If you want to add files to Liferay's Document Library then check out the following classes:
http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/documentlibrary/service/DLFileEntryLocalServiceUtil.html
http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/documentlibrary/service/DLFolderLocalServiceUtil.html

How to upload file ,create new folder using ssh_connent function php?

How to upload file, create new folder using ssh_connent function php.
get.php file uploaded http://xxxx.com/demo/review/
But the review folder doesn't exist on the xxxx.com. I want to create review folder then upload the get.php file.
See ssh2_ftp function manual:
http://php.net/manual/en/function.ssh2-sftp.php