You need to sign in to do that
Don't have an account?
Mathew Andresen 5
checkboxes with visualforce PDF generation
Hi,
I have a PDF quote that is generated by visualforce. Everything works fine, except I am having problems with the checkboxes. I saw in one post that checkboxes don't work in PDF's and you have to try images.
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000999tIAA
But this only seems to work sometimes for me. Sometimes the image will show checked, other times not.
For example, I tried
But if I try
I get a 4 checkboxes. including some that I haven't told to have checked.
Whole code below
Hopefully I'm just making a stupid mistake, but I'm worried there is a bug somewhere
Thanks,
I have a PDF quote that is generated by visualforce. Everything works fine, except I am having problems with the checkboxes. I saw in one post that checkboxes don't work in PDF's and you have to try images.
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000999tIAA
But this only seems to work sometimes for me. Sometimes the image will show checked, other times not.
For example, I tried
<apex:outputtext rendered="{!if(opportunity.Crossflow__c,true,false)}" escape="false"> <td>Crossflow: <img src="/img/checkbox_checked.gif"/> </td> </apex:outputtext> <apex:outputtext rendered="{!if(opportunity.Crossflow__c,false,true)}"> <td>Crossflow: <img src="/img/checkbox_unchecked.gif"/> </td> </apex:outputtext>and nothing happens
But if I try
<apex:outputtext rendered="{!if(opportunity.Crossflow__c,true,false)}" escape="false"> <td>Crossflow: <img src="/img/checkbox_checked.gif"/> </td> </apex:outputtext> <apex:outputtext rendered="{!if(opportunity.Crossflow__c,false,true)}"> <td>Crossflow: <img src="/img/checkbox_unchecked.gif"/> </td> </apex:outputtext> <img src="/img/checkbox_unchecked.gif"/> <img src="/img/checkbox_checked.gif"/>
I get a 4 checkboxes. including some that I haven't told to have checked.
Whole code below
<apex:page standardController="Opportunity" showHeader="false" renderas="pdf"> <!-- <head> <style>@page {size:landscape;</style> </head> --> <img src="/img/checkbox_unchecked.gif"/> <img src="/img/checkbox_checked.gif"/> <table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1"> <tr> <td> <img src='{!URLFOR($Resource.Logo)}' title="logo" /> </td> <td align="right"><font face="Arial" > <b>Contract for {!Opportunity.Account.Name}</b></font><br/> </td> </tr> <hr/> <table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1"> <tr> <td ><font face="Arial" > {!$Organization.Name}<br/> {!$Organization.Street}<br/> {!$Organization.City} {!$Organization.State}. {!$Organization.PostalCode} <br/> </font></td> <td width="50%"> </td> <td ><font face="Arial">Contract Number: <br/> <br/> Offer valid Through: <apex:OutputField value="{!Opportunity.CloseDate}"/><br/> Proposed by: {!Opportunity.Owner.LastName} {!Opportunity.Owner.FirstName}</font> </td> </tr> </table> <hr/> <p><b><font face="Arial" color="#000080">Address Information</font></b></p> <table border="0" width="100%" id="table2"> <tr> <td colspan="3"> <font face="Arial">Account name: {!Opportunity.Account.Name} <br/></font> <font face="Arial">Bond Number: {!Opportunity.Bond_Number__c} <br/></font> </td> </tr> <tr> <td> <font face="Arial">Bill To:<br/> {!Opportunity.Account.BillingStreet}<br/> {!Opportunity.Account.BillingCity} {!opportunity.account.BillingState}. {!Opportunity.Account.BillingPostalCode} </font> </td> <td width="50%"></td> <td > <font face="Arial">Ship To:<br/> {!Opportunity.Account.ShippingStreet}<br/> {!Opportunity.Account.ShippingCity} {!opportunity.Account.ShippingState}. {!Opportunity.Account.ShippingPostalCode} </font> </td> </tr> </table> <hr/> </table> <!-- *************************************************************************************************************** --> <table width="100%" id="table5"> <tr> <td width="50%"><b>{!$Organization.Name}</b></td> <td width="50%"><b>{!Opportunity.Account.Name}</b></td> </tr> <tr> <td width="50%"> </td> <td width="50%"> </td> </tr> <tr> <td width="50%">Signature<hr color="black" size="1"/></td> <td width="50%">Signature<hr color="black" size="1"/></td> </tr> <tr> <td width="50%">Name<hr color="black" size="1"/></td> <td width="50%">Name<hr color="black" size="1"/></td> </tr> <tr> <td width="50%">Title<hr color="black" size="1"/></td> <td width="50%">Title<hr color="black" size="1"/></td> </tr> <tr> <td width="50%">Date<hr color="black" size="1"/></td> <td width="50%">Date<hr color="black" size="1"/></td> </tr> </table> <p> </p> <hr/> <!-- <p align="center"><font face="Arial"><i>Copyright {!$Organization.Name}.</i></font></p> --> <!-- *************************************************************************************************************** --> <!-- <div style="page-break-after:always;"> </div> --> <!-- *************************************************************************************************************** --> <p><b><font color="#000080" face="Arial">Products</font></b></p> <table border="0" width="100%" id="table4"> <tr> <td bgcolor="#C0C0C0"><font face="Arial">Product</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Item ID#</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Variety</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Vintage</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Appelation</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Alc %</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Quantity</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Unit Price</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Total Price</font></td> </tr> <tr> <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line"> <tr> <td>{!line.PricebookEntry.Name}</td> <td>{!line.Item_Id__c}</td> <td>{!line.Variety__c}</td> <td>{!line.Vintage__c}</td> <td>{!line.Appelation__c}</td> <td>{!line.Alc_Percent__c}</td> <td>{!line.Quantity}</td> <td><apex:OutputField value="{!line.UnitPrice}"/></td> <td><apex:OutputField value="{!line.TotalPrice}"/></td> </tr> </apex:repeat> </tr> <tr> <td bgcolor="#C0C0C0" align="right" colspan="9"> <font face="Arial"><b>Total:</b> <apex:Outputtext value="{0,number,$###,###,##0.00}"> <apex:param value="{!opportunity.amount }"/> </apex:outputText> </font></td> </tr> <tr> <td align="right" colspan="9"> <font face="Arial"><b>Deposit:</b> <apex:outputText value="{0,number,$###,###,##0.00}"> <apex:param value="{!opportunity.amount * (opportunity.Deposit_Percent__c / 100)}"/></apex:outputText> </font></td> </tr> </table> <br/> <hr/> <!-- *************************************************************************************************************** --> <p><b><font color="#000080" face="Arial">Treatments</font></b></p> <table border="0" width="100%"> <tr> <apex:outputtext rendered="{!if(opportunity.Crossflow__c,true,false)}" escape="false"> <td>Crossflow: <img src="/img/checkbox_checked.gif"/> </td> </apex:outputtext> <apex:outputtext rendered="{!if(opportunity.Crossflow__c,false,true)}"> <td>Crossflow: <img src="/img/checkbox_unchecked.gif"/> </td> </apex:outputtext> <img src="/img/checkbox_unchecked.gif"/> <img src="/img/checkbox_checked.gif"/> <apex:outputtext rendered="{!if(opportunity.Alc_Removal__c,true,false)}"> <td>Alc Removal: <img src="/img/checkbox_checked.gif"/> </td> </apex:outputtext> <apex:outputtext rendered="{!if(opportunity.Alc_Removal__c,true,false)}"> <td>Alc Removal: <img src="/img/checkbox_checked.gif"/> </td> </apex:outputtext> <td>Alc Removal: <apex:outputField value="{!opportunity.Alc_Removal__c}"/> </td> <td>VA Removal: <apex:outputField value="{!opportunity.VA_Removal__c}"/> </td> </tr> <tr> <td>Cold Stablity: <apex:outputField value="{!opportunity.Cold_Stability__c}"/> </td> <td>Beginning Alc: <apex:outputField value="{!opportunity.Beginning_Alc__c}"/> </td> <td>None: <apex:outputField value="{!opportunity.no_treatment__c}"/> </td> </tr> <tr> <td>Heat Stability: <apex:outputField value="{!opportunity.Heat_Stability__c}"/> </td> <td>Finished Alc: <apex:outputField value="{!opportunity.Finished_Alc__c}"/> </td> <td>Other: <apex:outputField value="{!opportunity.other_treatment__c}"/> </td> </tr> </table> <br/> <hr/> <!-- *************************************************************************************************************** --> <apex:outputtext rendered="{!if(or(NOT(ISNULL(opportunity.Glass__c)), NOT(ISNULL(opportunity.Closure__c)), NOT(ISNULL(opportunity.Capsule__c)), NOT(ISNULL(opportunity.Capusle_Color__c)) ), true, false) }" escape="false"> <p><b><font color="#000080" face="Arial">Packaging</font></b></p> <table border="0" width="100%"> <tr> <td>Glass: {!opportunity.Glass__c}</td> <td>Closure: {!opportunity.Closure__c}</td> <td>Capsule: {!opportunity.Capsule__c}</td> <td>Capsule Color: {!opportunity.Capusle_Color__c}</td> </tr> </table> </apex:outputtext> <hr/> <!-- *************************************************************************************************************** --> <apex:outputtext rendered="{!opportunity.special_notes__c != NULL }"> <p><b><font color="#000080" face="Arial" >Special Notes:</font></b></p> <p> {!opportunity.Special_Notes__c} </p> <br/> </apex:outputText> <!-- *************************************************************************************************************** --> <div style="page-break-after:always;"> </div> <!-- *************************************************************************************************************** --> <p><b><font color="#000080" face="Arial">Payment Terms</font></b></p> <hr/> <apex:outputText > <p> {!opportunity.Payment_Terms__c} </p> </apex:outputText> <!-- *************************************************************************************************************** --> <p><b><font color="#000080" face="Arial">Terms and Conditions</font></b></p> <apex:outputText rendered="{!if(Opportunity.type=='Bulk Wine', true, false)}"> <p><b>Taxes:</b> State and Federal taxes to be paid by customer. </p> <p>This agreement is for the bond to bond purchase and transfer of Bulk Wine. The Bulk Wine has been inspected and accepted by the Buyer, and this is considered an "as is" purchase. Wine is to be finished and bottled offsite. 30 days storage from contact signing or arrival of bulk wine has been included. Customer to provide all vessels for wine transfer within this allotted 30 days. Storage beyond the allotted 30 days will be calculated separately. If no such vessels are provided, customer will be subject to barrel rental fees and storage per Exhibit B3. Bulk sale occurs, and ownership of wine transfers, when buyer approves this sale agreement via signature. </p> <p> For microbial stability testing, we recommend the use of Vinquiry. www.enartisvinquiry.com southern California location Santa Maria Branch 2717 Aviation Way, Suite 100, Santa Maria, CA 93455, Tel:805-922-6321 fax:805-922-1751 or northen California location Napa Branch 1282 Vidovich Avenue, Suite C, St. Helena, CA 94574, tel:707-967-0290 fax:707-967-0295. </p> <p> These terms and conditions apply to the purchase of unlabeled bottled wines (“Shiners”) purchased by Buyer in the Contract from Terravant Wine Company, LLC (“Terravant”; Buyer and Terravant together, the “Parties”). </p> <p> <b>Condition of Wine.</b> Buyer has inspected, sampled and/or tested the Bulk Wine to Buyer's full satisfaction. Buyer will be given an opportunity to re-sample the Bulk Wine at any time up to, and including, the Delivery Date. Delivery of the Bulk Wine by Seller to Buyer on the Delivery Date shall constitute full acceptance by Buyer of the Bulk Wine. Seller has made no representation or warranty as to the quality, characteristics or suitability of the wine for any purpose or use. The Bulk Wine is sold in "as is" condition. Seller does warrant it is the owner of the Bulk Wine, free to sell it to Buyer, and that the Bulk Wine is free and clear of any liens and encumbrances and it complies with any applicable Federal and State Laws or Regulations concerning such wine. </p> <p> <b>Release, Disclaimer and Waiver of Consequential Damages, Limitation of Liability and Hold Harmless.</b> The parties recognize and acknowledge that the winemaking process involves many intangible and subjective factors, that personal preferences and opinions often differ widely concerning wine quality, and that the limitation of liability set forth herein is a material inducement for Seller to enter into this Agreement. Accordingly: </p> <p> Buyer acknowledges and agrees that Seller's legal liability under or resulting from this Agreement, based upon any claim by Buyer, whether for negligence, breach of this agreement, breach of warranty, express or implied, or upon any other basis in law or equity, shall be strictly and solely limited to money damages in an amount which shall not exceed, under any circumstances, the actual price paid by the Buyer to the Seller for the Bulk Wine. This limitation shall be the full and only extent of Seller's liability regardless of the form in which any legal or equitable action may be brought against Seller, and the foregoing shall constitute Buyer's sole and exclusive remedy. in no event shall Seller be liable for any special, indirect, incidental, consequential or punitive damages, or for loss of profits or for any other damages or other legal liability of any kind, beyond or different than the limited measure of recoverable damages expressly agreed to herein. Seller makes no representation or warranties with respect to the Bulk Wine delivered under this Agreement whether express or implied, including without limitation any warranties of merchantability or fitness for a particular purpose and all such warranties are expressly waived and disclaimed except as set forth herein. Buyer hereby releases Seller, its agents and employees, from any claims, demands, damages, liability or causes of action for any monetary recovery except as expressly set forth and limited above and agrees to hold Seller, its agents and employees free and harmless there from. The parties recognize it would be impracticable and extremely difficult to determine and fix actual damages in the event of any breach, act or omission by Seller, its agents or employees, as referenced above and the parties agree that the limitation upon damages specified above represents their joint, good faith, best effort to fairly set and limit any such damages and it shall apply and control regardless of alleged or actual other or further damages, claims, losses, expenses or costs of any kind. </p> <p> <b>Indemnification.</b> Buyer shall defend, indemnify and hold harmless Seller, its owners, members, officers, directors, shareholders, representatives, agents and employees, against any and all liability, loss or expense of any kind, including but not limited to claims, damages, costs, fees (including reasonable attorney's fees, interest, accounting fees, expert witness fees, costs, and expenses), losses, recoveries, settlement expenses and/or fines, incurred by Seller, whether or not foreseeable, contingent or otherwise and whether directly or indirectly arising from or related to any act, omission, negligence, whether active or passive, breach or other conduct of Seller, its agents or employees, arising out of Buyer's use of the Bulk Wine. </p> <p> <b> Non-Disclosure.</b> Buyer and Seller agree that (except as may be required by law) they, and each of them respectively, will not disclose, and will not allow the disclosure of, any of the terms and conditions of this Agreement to any third party without the prior written consent of the non-disclosing party. Buyer and Seller hereby represent that they understand the confidential nature of this Agreement and will use all efforts to ensure that the terms and conditions of this Agreement remain confidential and will cause their officers, directors, employees, representatives, agents, advisors and consultants not to disclose any of the terms or conditions hereof. Buyer and Seller further covenant and agree that they will not disclose the origin of the Bulk Wine (except for appellation or geographic designation) nor disclose each other’s identity to any third party. Buyer shall not be entitled to use any trade names, trademarks or trade dress of or related to Seller in any way, including, without limitation, the marketing or distribution of, or advertising for the sale of, any of the Bulk Wine or any wine blended therewith, nor shall Buyer acquire any interest in the trade names trademarks or trade dress of Seller. </p> <p> <b>Venue:</b> Any arbitration or other legal action arising out of, or related to, this Agreement shall be venued in Santa Barbara County, CA. </p> <p> <b>Governing Law.</b> This Agreement shall be governed by and construed according to the laws of the State of California. </p> <p> <b>Successors and Assigns.</b> This Agreement shall be binding on all successors, permitted assigns, heirs, and executors of the parties and shall not be assigned by either party without the prior written consent of the other party. </p> </apex:outputText> <!-- ********************************************************************************************************************************* --> <apex:outputtext rendered="{!if(or(Opportunity.type =='Finished Case Goods',Opportunity.type=='Custom Blend', Opportunity.type=='Private Label'), true, false)}"> <p> These terms and conditions apply to the purchase of bottled wines (“Shiners”) purchased by Buyer in the Contract from Terravant Wine Company, LLC (“Terravant”; Buyer and Terravant together, the “Parties”). </p> <p> <b>Responsibilities of Parties.</b> At the request of Buyer, Terravant shall be responsible for labeling and packing the Shiners, using the label and intellectual property (“Label”) provided by Buyer. Buyer shall be responsible for providing the Label, for paying for the Shiners, and for arranging and paying the freight for the removal of the Shiners from Terravant storage as required by the terms of the Contract. Buyer shall provide proof of all federal and state required licenses and permits including but not limited to those required by the California Department of Alcoholic Beverage Control (“ABC”), Federal Alcohol and Tobacco Tax and Trade Bureau (“TTB”), and the California Board of Equalization. </p> <P> <b>Recordkeeping.</b> Terravant shall be responsible for all cellar recordkeeping required in connection with the labeling of Buyer’s Shiners. Source documents will be maintained by Terravant to support the label claims for Buyer’s labeled Shiners. Upon request, Terravant will make its records available for inspection by representatives of regulatory agencies. </P> <p> <b>Labeling</b> It is the responsibility of TWC as the bottler to obtain a Certificate of Label Approval (COLA) for wines bottled in our facility. Please submit your label art to TWC at least 45 days in advance of shipping so we may obtain a COLA for your label. All labels should include the statement “Vinted and bottled by_____, Buellton, CA.” If we are unable to obtain a COLA for your label before shipping, we will transfer the unlabeled wine to a bonded location of your choosing with a copy of our COLA and we will work with you to obtain approval of your label after you have received the wine. It is your responsibility to affix a label with an approved COLA to the purchased wine bottles. Note that unlabeled bottled wine may only be transferred in bond with an approved COLA and that unlabeled wine should not be removed from bond as “tax-paid.” </p> <p> <b>Removal from Terravant Bond.</b> Shiners shall be tax-paid by Buyer upon removal from Terravant premises unless arrangements for bond-to-bond transfer are made with Terravant. Shiners may be transferred in bond and stored in bond in Terravant’s bonded storage facility or another bonded storage facility. Terravant’s staff will prepare a bill of lading and bond-to-bond transfer form from Buyer to Terravant or such other bonded facility as Buyer shall specify. Terravant will not pay taxes upon removal of wine from bond. If wine is stored under Terravant’s bond, it must be tax-paid by Buyer prior to removal for delivery to Buyer. </p> <p> <b>Prices and Payment Schedule.</b> The prices and payment schedule for labeled Shiners are listed on the Contract. If terms are not met, contract will be voided. Labeled Shiners shall not be removed from Terravant premises prior to payment in full by Buyer unless otherwise agreed in writing by the Parties. Terravant shall have a lien on Buyer’s labeled Shiners for all amounts due and payable under the Contract and may sell Buyer’s wine at a public or private sale to satisfy Terravant’s lien, as permitted by law. </p> <p> <b>Sales Tax Liability.</b> Buyer will be responsible and liable for payment of all applicable sales taxes. Buyer will provide Terravant with a resale certificate on a form acceptable to Terravant. If Buyer neglects to provide such certificate, then at Terravant’s sole option it can pay the sales tax due and collect the tax from Buyer. </p> <p> <b>Storage and Removal.</b> Storage charges will begin 30 days after project completion at a charge of $0.20 per case per month. Long term storage is subject to approval and buyer must enter into a custom crush agreement with TWC for the duration. Removals by full pallet quantities only. It is the Buyer's responsibility to organize trucking companies to remove the wine from TWC's Santa Maria facility. TWC requires a minimal 48 hour notice for pick up. </p> <p> <b>Limitation of Liability.</b> In no event shall Terravant be liable for any incidental, consequential or special damages, interest, costs or expenses, or for loss of use of lost profits or wages, incurred by buyer in connection with the purchase or sale or use of goods, whether or not Terravant knew such damages might be incurred. Buyer shall not off-set any costs against invoice payment unless approved in advance in writing by Terravant. </p> <p> <b>Force Majeure.</b> In the event either Terravant or Buyer is unable to perform its obligations under the Contract because of the passage hereafter of any laws or regulations, or because of any legal or administrative proceedings of any government or governmental agency, court or administrative agency order, strikes, boycotts, lockouts, other labor disturbances, interruption of power, Terravant’s temporary or permanent lack or loss of processing capacity for reasons outside Terravant’s reasonable control, fire, explosion, catastrophe, crop failure or shortage as a result of uncontrollable actions of the elements, or other Act of God, then the party so affected shall, while to the extent so affected be relieved to the extent thus prevented from performing its obligations hereunder. </p> <p> <b>Governing Law.</b> This Agreement shall be governed by, construed, and enforced in accordance with, and subject to, the laws of the State of California. </p> <p> <b>Dispute Resolution.</b> The Parties shall first attempt to resolve any dispute related to this Agreement in an amicable manner. If unable to resolve the issue, the parties will choose a mutually acceptable mediator in Santa Barbara, California to assist with resolution of the matter. If unable to agree upon an acceptable mediator, either party may ask a mutually agreed-upon mediation service to appoint a neutral mediator, and the mediation shall be conducted under the Commercial Mediation Rules of the mutually acceptable mediation service. Any disputes remaining unresolved after mediation shall be settled by binding arbitration conducted in Santa Barbara, California at JAMS, in accordance with JAMS arbitration administration policies and JAMS arbitration procedures. The prevailing party shall be entitled to recover its costs and reasonable attorney’s fees, as determined by the arbitrator. The arbitrator shall be required to follow the law. </p> </apex:outputtext> </apex:page>
Hopefully I'm just making a stupid mistake, but I'm worried there is a bug somewhere
Thanks,
All Answers
In your first example you mentioned nothing happens. Is that the case when opportunity.Crossflow__c is false or true? Same question for you second example.
Note, I have experimented with replacing the images with a simple yes or no, and that works fine