This topic is locked

Create a "landscape" PDF file and save it in the output folder

7/10/2021 6:23:04 PM
PHPRunner General questions
A
Andreas G. author

Creating a PDF in landscape orientation and saving it in the output folder?

Create PDF only works in portrait format !

How can I force output in landscape format?

I use the instructions from the help:

Example: Creating and saving a PDF file to disk

Client before:

ajax.addPDF( 'pdf', {}, function() {

return ctrl.dialog( {
title: 'Save results as PDF',
fields: [{
name: 'filename',
value: 'file.pdf'
}]
});
});
return false;

Server:

$filename = str_replace( array( '/', '\\'), '', $params["filename"]);

$dot = strrpos( $filename, "." );
if( strtolower(substr( $filename, $dot )) !== '.pdf' ) {
$filename .= '.pdf';
}
file_put_contents( $filename, $params["pdf"] );

Client after:

window.open( params['filename'] );

Thanks for a help
Greetings from Germany

HJB 7/10/2021

Go to "PAGES" section in PHPRunner and then drill down to "Printer-friendly" respectively
its setting by clicking on the settings button. Choose LANDSCAPE ..., and you'r done.

A
Andreas G. author 7/10/2021

Was set to landscape format but this option does not change anything.

It just doesn't work with the custom button and code

admin 7/10/2021

RTFM please

HJB 7/10/2021

... just tested at my end, it worked. PDF View in landscape and Print (save PDF to disk) in landscape too ...

img alt

A
Andreas G. author 7/11/2021

Thanks for the help but I get

orientation: landscape

Not as pure as I would like.

It's about the code from the first post!

Printing as PDF and layout selection work normally.

Only with "save as PDF and PDF will open in a new window" I can't do it .... I'm still a beginner

I will look for another solution

HJB 7/11/2021

Your "new" window problem after PDF saving has nothing to do
with PHPRunner code, it relates to the browser configuration.

Steps to avoid PDF file opening in a new window
after saving for Google Chrome web browser

  1. Open Chrome Settings.
  2. Expand Advanced.
  3. Select Downloads.
  4. Select Clear next to "Open certain file types automatically after downloading" ...
  5. Go to Privacy and security.
  6. Expand Site Settings.
  7. Click on PDF Documents.

A
Andreas G. author 7/12/2021

I come from Germany and translate my question with google
The problem with the browser does not exist!

I have to follow these instructions

https://xlinesoft.com/phprunner/docs/creating_and_saving_pdf_to_disk.htm

created a custom button.
That's working.

The file is only created in portrait mode

But if I follow the instructions:
Document appearance options

https://xlinesoft.com/phprunner/docs/pdf_parameters.htmorientation {string}

Sets the PDF orientation.

Possible values:

•portrait

•landscape

insert orientation: landscape, the output does not change.
Always portrait mode

That's the problem.
Otherwise everything works fine

Greetings from Germany

HJB 7/12/2021

PDFMAKE - PAGE DIMENSIONS, ORIENTATION AND MARGINS

It's my understanding from above URL content that the correct "landscape" syntax reads:

// by default we use portrait, you can change it to landscape if you wish
pageOrientation: 'landscape',

In other words, within PHPRunner 10.5 that third party code made by PDFMAKE is
responsible for PDF output of all kinds. So, since

https://xlinesoft.com/phprunner/docs/pdf_parameters.htm
orientation {string}

Sets the PDF orientation.

Possible values:

•portrait

•landscape

talks about different syntax, you need to gamble here a little bit.