Skip to content

why not change the page orientation when saving as pdf #978

@daitkhealex

Description

@daitkhealex

I wanted to change the page orientation, and realized that it was impossible to do
public function save($filename = null)
{
$fileHandle = parent::prepareForSave($filename);
// PDF settings
$paperSize = strtoupper('A4');
$orientation = strtoupper('portrait');
// Create PDF
$pdf = new \mpdf();
$pdf->_setPageSize($paperSize, $orientation);
$pdf->addPage($orientation);

// Write document properties
$phpWord = $this->getPhpWord();
$docProps = $phpWord->getDocInfo();
$pdf->setTitle($docProps->getTitle());
$pdf->setAuthor($docProps->getCreator());
$pdf->setSubject($docProps->getSubject());
$pdf->setKeywords($docProps->getKeywords());
$pdf->setCreator($docProps->getCreator());
$pdf->writeHTML($this->getContent());
// Write to file
fwrite($fileHandle, $pdf->output($filename, 'S'));
parent::restoreStateAfterSave($fileHandle);
}


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions