You need to sign in to do that
Don't have an account?
Visualforce Page RenderAs PDF does not respect <ol> start attribute
Hello everyone,
I am having an issue with the renderAs=pdf functionality using Visualforce pages.
We often have ordered lists that are broken and are restarted, so <ol start="num"> is used.
It does not look like Visualforce pages while rendered as PDFs respect the start attribute.
Example code:
<ol>
<li> List Item 1</li>
<li>List Item 2</li>
</ol>
<apex:image src="src"></apex:image>
<ol start="3">
<li>List Item 3</li>
</ol>
Should be displayed like this:
1. List Item 1
2. List Item 2
{{IMAGE HERE}}
3. List Item 3
Instead it is displayed like this:
1. List Item 1
2. List Item 2
{{IMAGE HERE}}
1. List Item 3
Is there something that could be done to get around this? We have a need to dynamically create PDFs of Knowledge Articles so it needs to dynamically load the content of the Knowledge Article that is passed to it.
Thanks
While I know this would work there is a need for it to work the way it currently is written. We have a separate Knowledge Manager that composes these articles. I cannot simply tell them that they can no longer start a ordered list from a different number. There needs to be a way to deal with this that does not require fixing the underlying html in our knowledge articles.
Here is the solution for your issue without changing order.Hope this helps!
Note : I have added url attribute and sample image for demo purposes.Pls change according to your needs.
Working code :
Result pdf snippet :
If this helps,mark this as best answer so others too can benefit.
Regards,
Santosh.
Hi Jordan Vasquez,
Also pls change linke 26 to <li>List Item 3</li> from <li value="3">List Item 3</li> It works.
Regards,
Santosh.
That was close but no cigar. It seemed to add bullet points in front of sub-bullets. Also, we have multiple lists on the same article. I am sorry if this was something that I should have mentioned from the start.
Example, this is what we can expect in an article of ours:
1. List Item 1
2. List Item 2
{{IMAGE}}
3. List Item 3
Header for new Section of article
1. List Item 1
2. Sub List Item 2
3. List Item 3