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
iswarya sekar 7iswarya sekar 7 

How to give alignments for VF page

public class PrintPageController {
    Public CPL_Protocols__c cp{get;set;}
    public ID cplid{get;set;} // used to pass values from controller to VF page.
    
    public PrintPageController(ApexPages.StandardController controller) {    // Default Constructor Method to fetch data.
        cplid = apexpages.currentpage().getparameters().get('Id');
        
        if(cplid!=null){
            cp =[select id,ownerId,Study_Protocol_Number__c,Approval_Step_Status__c,Status_Date_Time_Stamp__c,Protocol_Status__c, Labels_Due_Date__c,
                 Number_of_Labels_to_Printed__c,Contact__c,user_email__c,Name,
                 Number_of_Study_Sites__c,Study_Type__c,Treatment_Period__c,Country__c,
                 Study_Phase__c,Study_Protocol_Description__c,No_of_Treatment_Grp__c,Enrollment_Period__c,
                 Study_Duration__c,Dosing_Regimen__c,Primary_Packaging__c,Secondary_Packaging__c,Label_Information__c,
                 Labeling_Lot_Number__c,Storage_Requirements__c,Max_Exposure_Time__c,Label_Expiration_Date__c,
                 Packaging_Site__c,Labeling_Site__c,Quantity_Required__c,Sampling_Requirements__c,CreatedById,Labeling_Package_Instructions__c,
                 Calculated_Qty_to_be_Prepared__c,Randomization__c,Randomization_File_Acknowledgement__c,LastModifiedById
                 from CPL_Protocols__c where id=:cplid]; // using ID, it displays the CPL Fields.
            system.debug('The value of CPL Prtocol is'+cp); // To Find and Resolve problems in execution.
        } 
    }
}





VF page:

<apex:page standardController="CPL_Protocols__c" renderAs="pdf" applyBodyTag="false" docType="html-5.0" standardStylesheets="false" showHeader="false" extensions="PrintPageController">
    
    <apex:form >
        <apex:pageBlock title="CPL Request Information Detail">
            <apex:pageBlockSection title="Status" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.OwnerId}"/>  
                <apex:outputfield value="{!CPL_Protocols__c.Study_Protocol_Number__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Approval_Step_Status__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Status_Date_Time_Stamp__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Protocol_Status__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labels_Due_Date__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Number_of_Labels_to_Printed__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Contact__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.user_email__c}"/>  
            </apex:pageBlockSection> 
        </apex:pageBlock>
        
        
        <apex:pageblock >
            <apex:pageBlockSection title="Study Information" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.Name}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Number_of_Study_Sites__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Type__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Treatment_Period__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Country__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Phase__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Protocol_Description__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.No_of_Treatment_Grp__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Enrollment_Period__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Duration__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Dosing_Regimen__c}"/>  
            </apex:pageBlockSection>
        </apex:pageblock>
        
        <apex:pageblock >
            <apex:pageBlockSection title="Product Information" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.Primary_Packaging__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Secondary_Packaging__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Label_Information__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labeling_Lot_Number__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Storage_Requirements__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Max_Exposure_Time__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Label_Expiration_Date__c}"/>   
            </apex:pageBlockSection>
        </apex:pageblock>
        
        <apex:pageblock >
            <apex:pageBlockSection title="Packaging/Labeling Operation" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.Packaging_Site__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labeling_Site__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Quantity_Required__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Sampling_Requirements__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.CreatedById}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labeling_Package_Instructions__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Calculated_Qty_to_be_Prepared__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Randomization__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Randomization_File_Acknowledgement__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.LastModifiedById}"/>   
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
    
    <apex:relatedList list="Parts__r" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="Histories" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="ProcessSteps" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="ActivityHistories" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="OpenActivities" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="AttachedContentDocuments" />
    
    
</apex:page>

 
Deepak Kumar SharmaDeepak Kumar Sharma
Hi Iswarya,
Just Open your VF Page in "developer console" and select overall code by Ctrl+A and then press key Ctrl+Shift for making proper alignment of your code.
iswarya sekar 7iswarya sekar 7
Hi Deepak,

this VF page will render a PDF document. so I have to give alignments to that PDF.