• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Change paper size based on dropdown in PHP PDF Pre

Change paper size based on dropdown in PHP PDF Pre 5 years 11 months ago #39096

  • patrick403
  • patrick403's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Thank you received: 5
How can I change the paper size in PHP PDF Pre-Processing Scripts

If the override is this:
$pdf->dompdf->set_paper('a5','landscape');

How can i change the value of the 'a5' based on a dropdown?

Currently I have this but it doesn't work
$size='{papersize:value}';
$pdf->dompdf->set_paper('$size','portrait');
The administrator has disabled public write access.

Change paper size based on dropdown in PHP PDF Pre 5 years 11 months ago #39097

  • patrick403
  • patrick403's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Thank you received: 5
Solved

I needed two different sizes based on the dropdown - "legal" and "8.5x11". Here is how I solved it:
$size='{papersize:value}';
$value_key=array_search($size,$args['placeholders']);
if ($args['values'][$value_key]=='legal')
$pdf->dompdf->set_paper('legal','portrait');
 
$size='{papersize:value}';
$value_key=array_search($size,$args['placeholders']);
if ($args['values'][$value_key]=='8.5x11')
$pdf->dompdf->set_paper('8.5x11','portrait');
Last Edit: 5 years 11 months ago by patrick403. Reason: Forgot to add details
The administrator has disabled public write access.
The following user(s) said Thank You: kevin.morrison

Change paper size based on dropdown in PHP PDF Pre 5 years 11 months ago #39098

  • patrick403
  • patrick403's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Thank you received: 5
Simplified
$size='{papersize:value}';
$value_key=array_search($size,$args['placeholders']);
if ($args['values'][$value_key]=='legal')
$pdf->dompdf->set_paper('legal','portrait');
 
else
 
if ($args['values'][$value_key]=='8.5x11')
$pdf->dompdf->set_paper('8.5x11','portrait');
The administrator has disabled public write access.
The following user(s) said Thank You: Specialist, gregs
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!