Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Export a bill in PD...
 
Notifications
Clear all

Export a bill in PDF but in portrait

4 Posts
2 Users
0 Reactions
5,089 Views
jean pierre huart
(@jphuart)
Posts: 35
Active Member
Topic starter
 
[#1499]

Hello,

I've created a new bill template that works fine.
It is correctly displayed in the report screen , but when I want to export it to PDF format it is always exported in landscape mode.
I found in the /view/print.php file, function finalizePrint() at line 154

$html2pdf = new HTML2PDF('L','A4','en');

Modifying 'L' in 'P' will export all my pdf in portrait mode.
But the pdf is cutting part of my report, so I suppose that I have to provide additional information (max width of my table report for example) somewhere.
In addition I would like to use the portrait mode for my new bill, but not for other PDF exports, so is it possible to define it somewhere?

I will be grateful for any idea about it.
Thanks

Jean Pierre


 
Posted : 01 Dec 2013 17H11
babynus
(@babynus)
Posts: 14953
Main Contributor Admin
 

But the pdf is cutting part of my report, so I suppose that I have to provide additional information (max width of my table report for example) somewhere.

It is probably linked to the size oy your tables or divs.
If you set size in px or mm or eml, it may be larger than page size
If you set size it %, it should auto adjust to page size.

I would like to use the portrait mode for my new bill, but not for other PDF exports, so is it possible to define it somewhere?

No, you'll have to have code it, something like :

if (myReport) $html2pdf = new HTML2PDF('P','A4','en'); else $html2pdf = new HTML2PDF('L','A4','en');

 
Posted : 01 Dec 2013 18H09
jean pierre huart
(@jphuart)
Posts: 35
Active Member
Topic starter
 

Here it is what I've done in the print.php file.

/* JPH added */
// $html2pdf = new HTML2PDF('L','A4','en');
$myReport = $_REQUEST 'reportFile' ;
if ($myReport == 'bill-jph.php') {
$html2pdf = new HTML2PDF ( 'P', 'A4', 'en', true, 'UTF-8', array(5, 18, 5, 10) );
} else {
$html2pdf = new HTML2PDF ( 'L', 'A4', 'en' );
}
/* end JPH */

And it works as I want.
But this is not the best way of doing it, on the next upgrade I will have to remodify the file.
For the bill, I've created a new file and modified into the database the call for the bill to my new file, so upgrading will remain easy.
I don't know well enough ProjeQtor to make a suggestion on how to allow customisations to remain compatible with core upgrades, but I would have found better if I could store the HTML2PDF arguments within the report file.

Thank you very much, anyway.
Ciao
Jean Pierre


 
Posted : 02 Dec 2013 0H20
babynus
(@babynus)
Posts: 14953
Main Contributor Admin
 

I don't know well enough ProjeQtor to make a suggestion on how to allow customisations to remain compatible with core upgrades

Yes, IT is a real constraint.
Not sure there is an easy clean solution.
Any suggestion is welcome.


 
Posted : 03 Dec 2013 2H33
Share:

Scroll to Top