function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
edoardo_spanoedoardo_spano 

Visualforce Component overlap

Hi All,

I need to create a PDF that must show two copies of the same document: one copy for the customer and one copy for the company.
These two documents are the same except for the header: into the header is specified if the copy is for the customer or for the company.

During my fisrt attempt I structured the page in this way:
<apex:page renderAs="pdf">
    <div class="header"></div>
    <div class="content">
        <!-- content for the customer's copy -->
        <div style="page-break-after: always;"></div>
        <!-- same content for the company's copy -->
    </div>
    <div class="footer"></div>
</apex:page>

But in this way the header it's the same for all the pages.

So, I created a Visualforce Component with a dynamic header, like this:
<apex:component>
    <apex:attribute name="isCustomerCopy" description="Specify if this copy is for the Customer" type="Boolean" required="true"/>

    <div class="header>
        <apex:outputLabel value="Customer's copy" rendered="{!isCustomerCopy}"/>
        <apex:outputLabel value="Company's copy" rendered="{!NOT(isCustomerCopy)}"/>
    <div>
    <div class="content"> <!-- content only once --> </div>
    <div class="footer"></div>
</apex:component>

Then I modified the visualforce page like this:
<apex:page renderAs="pdf">
    <c:MyComponent isCustomerCopy="true"/>
    <c:MyComponent isCustomerCopy="false"/>
</apex:page>

Now the header it's correct, but the two components result overlapped.

Does anyone have a solution for my problem?

Thanks in advance
KRayKRay
How are you determining the user type? Profile, Role, email address, etc?