You need to sign in to do that
Don't have an account?

Visualforce Page rendas .pdf tab issue
Dear community,
********************************************************************************************
Background:
I created a visualforce page for my Quote to get it as pdf.
So far it's working but i got an issue with my QuoteLineItems.( design problem)
********************************************************************************************
In my code i used the apex:repeatas you can see below :
<apex:repeat value="{!Quote.QuoteLineItems}" var="line"> <tbody id="lineItem"> ****Quote Line Items information are displayed here **** </tbody> </apex:repeat>
The problem come from the number of Quote Line Items, if have two or less items it's fine :
(all the informations are fake information from my sandbox)
Between two and five there is a problem for the price summary:
(all the informations are fake information from my sandbox)
With 5 items i don't have any problem :
and more than 5 my Quote Line item's tab is dirty:
(all the informations are fake information from my sandbox)
I'm not very skilled with this kind of design, so my questions are;
Should i created different page depend of the number of my quote line items?
Can we make a count on the visualforce page using apex?
I'm kind a lost .
Sincerely,
No problem, nice to see it finally works.
Anyway, it should be fine even if you have 30 or 40 line items. The page break will be inserted nicely at the point as defined in the apex:variable:
Regards,
Hengky
All Answers
I am not sure this is the best solution, but you can try add in css page-break-before or after property after a certain line of items to force the later line items to appear on the next page.
Regards,
Hengky
Hi,
I'm not very comfortable with css i should put it on my tab or line?
I'll give a look.
Thanks
Here i'am i tried your idea (it wasn't bad) but it moved my whole tab as you can see:
Regards,
Hengky
how can i close it after after one or two item for example ?
Regards,
Hengky
sorry my question was for the apex:repeat attribute.
How can i make just a few line
Could you provide some sample codes on how you use the apex:repeat?
Regards,
Hengky
you can see below an example ( similar of the example of my first post)
You could wrap the line items using a wrapper class, and you can use something like line type property to differentiate data line and page break.
So your line items would be something like this:
data
data
data
pagebreak
data
data
...
data
data
pagebreak
data
data
data
...
So, inside your <apex:repeat> you need to make use of the rendered attribute. If the line type is data, show the line item, if line type is pagebreak then show the table close tag.
I hope you get the idea.
Another way to achieve this is to build the complete table string in the controller, and then just output the string in the visualforce page.
Regards,
Hengky
So my wrapper class will get all the Quote Line Item of my quote on put them into an object (maybe a tab?).
I hope that i understood well, i never did any wrapper class before.
Anyway thanks for your help.
i will post my solution if it's working.=]
Maybe i'm thinking too much but i read somme example :
here or here.
But on my example i need two use a few different kind of item ( as Quote Opportunity).
So should i wrap with my quote and set an item list? but it's kind a mess for me ...
I'll figure out...
Sorry and thanks!
Hi,
Sorry about my previous post. To 'close' the table like below will not work because the open and close tags will get mixed up.
Anyway, there is another way to achieve this. I just figured out on how to use <apex:variable> as a counter inside the <apex:repeat> loop. You can use the counter as a page break point when it reached a certain number.
This way you don't have to write any wrapper class.
Here is the example:
Regards,
Hengky
Thanks for you help!!!!!!
I got it about the wrapper class but i don't think it's the best answer in my case.
So i tried to use the apex:variable but instead of using div i kep using my table/td/tr and i got this:
so far it's working for my first 5 items but for the others i have to set an others apex:outputPanel rendered for it ???
I think i'm on the good way! Just need to finish it and optimize it!
But i set a style="page-break-before:auto" on the summary information (after my tab) butthe auto parameter looks like not working very well.
anyway THANKS YOU i'm going back to my eclipse . =]
The problem when you use TR/TD and <apex:outputPanel> together inside an <apex:repeat> is that the generated table and span/div html tags are overlapping each other, i.e. span/div becomes child node of a table tag, which is invalid.
Try to view the HTML source code of the page (change the renderAs to anything but pdf for temporary). I think that was the cause of your current issue with the 2nd page.
Regards,
Hengky
Hi,
I tried to see my file as an html.
I don't have the problem the break appear.
Here my code:
I spent to much time on it i started to mess my self a little à___à
The apex:outputpanel generated as div, and div is not supposed to be a child object of table. It is invalid.
Regards,
Hengky
but the line you showed to me
The output Panel is independant, so i should the same with div? It's kind a mess but thanks.
Regards,
Antony
What I mean is:
Your generated HTML codes look something like this:
And a <div> inside a <table> is not valid.
Regards,
Hengky
ok ok ....
So i have to restart my page with div? or apex:output?
Yup. Use DIV instead.
Regards,
Hengky
Thanks dude!
You spent a lot of time and it was very helpful.
The solution is to use DIV when we need to create a dynamic Tab.
Now i juste have to manage dynamically when my Salesman will create very HUGE Opportunity.
Here the final tab:
No problem, nice to see it finally works.
Anyway, it should be fine even if you have 30 or 40 line items. The page break will be inserted nicely at the point as defined in the apex:variable:
Regards,
Hengky
Work until 30-40? awesome !