0

I have an HTML used Apex page which has renderas PDF tag for PDF conversion. But the content is too long and coming in two pages. I need to keep it in one Page. Can someone suggest a solution?

Apex Page

<apex:page showHeader="false" standardStylesheets="false" sidebar="false"
    standardController="Sample_Order_Form_abv__c" extensions="SaveAsPdfExtension"
    contentType="{! renderedContentType }" renderAs="PDF">


<html>
<style>
.container {
    overflow:auto;
}

.triangle {
  border-bottom: 15px solid #000;
  border-left: 10px solid ;
  border-right: 10px solid ;
  width: 0;
  height: 0;
}

.circle2
{
width:50px;
height:50px;
border-radius:50%;
font-size:5px;
color:#000000;
line-height:500px;
text-align:center;
background:#ffffff
}
p {
   margin: 5px 0;
}

.circle
{
background-color: #FFFFFF;   width: 20px;
   height: 20px;
   border-radius: 50%;
   line-height: 5px;
   text-align: center;
   border: 2px solid #000000;
   color: #ffffff;
   z-index: 10;
   font-family: "HelveticaNeueUltraLight", "HelveticaNeue-Ultra-Light", "Helvetica Neue Ultra Light",         "HelveticaNeue", "Helvetica Neue", 'TeXGyreHerosRegular', "Arial", sans-serif; font-weight:5; font-stretch:normal; 
   font-size: 5px;

}

.rectangle2
{
     width: 73.3%;
     height: 50%
     margin:5 auto;
     border-top:1px solid #000000;
     border-bottom:1px solid #000000;
     border-left:1px solid #000000;
     border-right:1px solid #000000;
     border-bottom-width:medium;
     border-left-width:medium;
     border-right-width:medium;
     border-top-width:medium;
}

.arrow-right {
    width: 10; 
    height: 10; 
    border-top: 60px solid ;
    border-bottom: 60px solid ;

    border-left: 60px solid black;
}
.right-arrow {
   display: inline-block; 
    display: &#9654;
    position: relative;
    background: black;
    padding: 15px;
}
.container1 {
    float:left;
}

.container2 {
    overflow:visible;
}

.image {
background:url(!$Resource.image_R);
background-size:80px 60px;/*Image Size - This will help you*/
background-repeat:no-repeat;
}
.sidebyside {
    float:left; 
    width:20px; 
    height:20px; 
    border-style:solid; 
    margin:0px;
}

.sidebyside1 {
    float:left; 
    width:20px; 
    height:20px;
    border-style:solid; 
    margin-left:20px;
}

.sidebyside2 {
    float:right; 
    width:20px; 
    height:20px;
    border-style:solid; 
    margin-left:0px;
}
.belowdiv {
    width:300px; 
    height:100px; 
    border-style:solid; 
    margin:5px;
}
</style>

<table align="right">
  <tr>
    <td> 
      <font size="5"> <b>{!SOF.Form_ID_abv__c}</b></font>
    </td>
  </tr>
</table>

<br></br><br></br>
   <table align="left">
   <tr>
    <td>
     <img src="{!$Resource.Humira}" width="200" height="100"/> 
    </td>
     <td>
    </td> <td>
    </td>
    <td>
    </td>
     </tr>
  </table>
   <table align="right">
     <tr>
    <td>
     <div  style="width:350px;float: right;height:120px;border:1px solid #000;" > <center><font size="1">  <br><b> The form is uniquely coded </b></br></font>  <font size="5"> <p><b> And valid for 1 time use only </b></p></font> <font size="2" > A new form is required for each subsequent order.  </font></center></div>
    </td>
   </tr>
   </table>


  <table align="right">
  <tr>
    <td>
<img src="{!$Resource.SampleRequest}" width="250" height="60"/>
    </td>
  </tr>
</table>

<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br>
<table align="left">
 <tr>
 </tr>
 <tr>
   <td>
<div id="rectangle" style="text-align: center;width:700px; height:30px; background-color:black" >  <span  style="font-weight:bold;color: #FFFFFF;font-size: 80%"> ATTENTION PRACTITIONER : PLEASE FILL IN ALL BLANK FIELDS TO ENSURE SAMPLE DELIVERY </span> </div>
   </td>
 </tr>
</table>    
<br></br>

<table align="left">
  <tr>
   <td> 
  <font size="5"> Deliver To : </font>
  <p> 

  <font size="5"> {!SOF.Account_abv__r.Name} , </font>  
  </p>
  <p><font size="5"> {!SOF.Address_Line_1_abv__c}  </font></p>

  <p> <font size="5"> {!SOF.Address_Line_2_abv__c}  </font>   </p>

  <p><font size="5"> {!SOF.City_State_Zip_abv__c}  </font></p>

  <p> <font size="5"> Phone: {!SOF.Account_abv__r.Phone}  </font> <font size="5"> Fax: {!SOF.Account_abv__r.Fax}  </font>  </p>



  <p> <font size="5"> State License #: {!SOF.Address_abv__r.License_vod__c }  </font>  </p>

  <p> <font size="5"> Rep. Territory#: {!SOF.Territory_abv__c}  </font> </p>



  <p></p>
  <p><font size="4" face="verdana">Deliveries can be received on (circle)    &nbsp; Tue &nbsp; Wed &nbsp; Thu &nbsp; Fri </font> </p>
  </td>
 </tr>

</table> 


<table align="right">
  <tr>
   <td> 
     <p><img src="{!$Resource.InstructionSection}" width="300" height="200"/></p>
     <p> <hr></hr> </p>
       <p> <hr></hr> </p>

    </td>
  </tr>

</table>


<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br>
<br></br><br></br><br></br><br></br><br></br><br></br>

<table align="center">
 <tr>
   <td>
  <div class="container2"><div id="rectangle" style="text-align: center;width:700px; height:30px; background-color:black" >   <span  style="vertical-align: top;font-weight:bold;color: #FFFFFF;font-size: 80%">  <br> You &nbsp;&nbsp; will &nbsp;&nbsp; receive &nbsp;&nbsp; the &nbsp;&nbsp; following &nbsp;&nbsp; prescription &nbsp;&nbsp; sample(s) </br> </span></div>
 <div style="width:690px;float: center;height:150px;border:5px solid #000;" > <center><font size="4">  <br> <b>{!SOF.Proprietary_Name_abv__c}   <img src="{!$Resource.Image_R}" width="20" height="20"/> {!SOF.Established_Name_abv__c} &nbsp;  {!SOF.Dosage_Strength_abv__c} &nbsp; {!SOF.NDC_abv__c}  &nbsp; Qty: {!SOF.Quantity_abv__c} </b>  </br> </font></center></div></div>
   </td>
 </tr>
</table>
<!--
 <br><div style="width:1300px;float: center;height:450px;border:5px solid #000;" > <br><left><font size="5"> By signing and returning this form, you acknowledge that you are currently licensed with the appropriate state and federal authorities to receive this product and would like Abbvie Inc. to provide you with complimentary samples of HUMIRA.<b>You also acknowledge that you currently have proper refrigeration facilities for HUMIRA.</b> Do not use beyond the expiration date on the container. HUMIRA must be refrigerated at 2° to 8°C (36° to 46°F). DO NOT FREEZE. Store in original container untill time of administration. </font></left></br> <br> <div class="right-arrow"><center><font size="4" color="#FFFFFF"> SIGN &amp; DATE HERE </font></center> </div> <center><div id="rectangle" style="width:1000px; height:200px; float:none ; border-style: solid; border-color:#000000" > <h1 align="left"><font size="10"> <br>&times;  &#x2015;&#x2015;&#x2015;&#x2015;&#x2015;&#x2015; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x2015;&#x2015;&#x2015; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#x2015;&#x2015;</br> </font> <font size="2"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (REQUIRED;checked one) </b></font></h1>   </div> </center> <span style="float:center;"> I requested the Rx items indicated for the medicals needs of my patients and may not chanrge my patients or third party provider, including medicare or medicaid, for these items. Sample shipments are made subject to product availability and regulated by state and federal law. Samples are not for sale. Samples manufactured by Abbvie. Distributed by J.Knipper and Company,Inc. </span> </br> </div></br>   -->


<table align="center">
<tr>
  <td>
     <img src="{!$Resource.SignDate}" width="700" height="300"/> 
  </td>
</tr>
<tr>
  <td>
     <font size="4">For questions, please call your HUMIRA Sales Representatives or the J.Knipper and Company Hotline at 1-800-250-1774.</font>
     <font size="5"> <b><br>Please refer to the provided full Prescribing Information (PI)  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPIRES &nbsp;&nbsp;  {!ExpDate}
       </br>
    <br>or visit http://www.rxabbvie.com/pdf/humira.pdf for full PI.</br>
    <br> Full Prescribing Information is also available by calling </br>
    <br>1-800-633-9110.</br> </b> </font>
      </td>
</tr>

</table>





<table align="left">
  <tr>
    <td>
   <img src="{!$Resource.Circle}" width="350" height="30"/> 
    </td>
  </tr>
</table>
<table align="right">
  <tr>   
    <td>
     <img src="{!$Resource.AbbvieImage}" /> 
  </td>
</tr>

</table>

<br></br><br></br><br></br> <br></br><br></br>
<table align="center">
  <tr>
    <td> 
      <font size="5"> <b>{!SOF.Form_ID_abv__c}</b></font>
    </td>
  </tr>
</table>   


</html>





    <!-- A little bit of info about the page's rendering; 
         see how it changes when saved as a PDF. -->
   <!-- contentType: <apex:outputText value=" {! renderedContentType }"/><br/>
    renderingService: <apex:outputText value=" {! renderingService }"/><br/> -->
</apex:page>

Please find how the pdf page splits in system. enter image description here

  • 1
    Have you tried reducing fonts sizes, removing margins and paddings etc. P.S. I haven't looked at your code. – Salesforcesmarty Feb 4 '16 at 5:43
  • Yes I did and reducing it more on Page code may affect my desired output. – Testing_SFDC Feb 4 '16 at 5:47
  • I can't predict how you page is looking like, can you add a snapshot of final page? – Salesforcesmarty Feb 4 '16 at 5:49
  • I have added the screenshot in the question. Please have a look. – Testing_SFDC Feb 4 '16 at 5:57
1

Try setting the page size in the <style> tag:

<style>
@page { size: 8.5in 11in; margin:0.0in; /* PDF width, height, margin */ }
</style>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.