• ISVforce Partner
  • 5 Points
  • Member since 2012

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 7

I am sure I am not the first one to encounter this. Has anyone worked with JS and VF (RenderAs="PDF") ?? 


I need to have  "Do you want to save this PDF to the Quote?" confirm dialog when user closes the window. For some reason, JS is not called when page is rendered as PDF. If I remove renderas"pdf" attribute from the page, it shows the popup. 


PDF cannot have alert just by nature of it, but is that true for VF pages rendered as PDF? Is there any work around?


Thanks for your time. 



Need help displaying HTML table as tooltip. I got below code from other thread. It works fine, but it displays HTML as OutputText. 


Any idea how I can modify this to show HTML as mouseover? Thanks. 



public Component.Apex.OutputText getGadgetHTMLContent(){
           Component.Apex.OutputText oppText = new Component.Apex.OutputText(escape = false);
           oppText.value = gadgetContent;       //gadgetcontent is the variable which holds the HTML content
           return oppText ;

VF Page

<apex:outputPanel rendered="{!gadgetHTMLContent!= null}" layout="none">
          <apex:dynamicComponent componentValue="{!gadgetHTMLContent}"/>

Does anyone know if it is possible using Apex to create or update a custom setting value specifically for a user Id or profile Id? The Salesforce documentation does not touch this functionality, so I don't know if it is even supported.



I'm looking to Access someting inside a Managed Package from outside of it, in a visualforce page.


Brief details:

Package A has all the apex code, and is fully functional on its own, but has no "customer facing" pages.  Person who installs this package uses it all with an admin panel.  Package A is managed.


Package B is unmanaged, and includes only a few files, visualforce pages that will use the classes inside the package as controllers/functions.


I am able to access visualforce pages and resources with "Package_A__pagename" etc, but cannot access the apex class in the controller attribute in the apex:page tag.


Any advice how to do what I'm trying to do?



below is the code that i have tried to do the cloning.


Account acc=new  Account(Name='ACC');
insert acc;
Opportunity CloneOpp= new Opportunity(Name='CloneOpp',AccountId=acc.id,Amount=222,StageName='xyz',CloseDate=System.today(),h1newContractEndDate__c=System.today());
 insert CloneOpp;

 Opportunity colned=CloneOpp.clone(true,false);
  system.debug('source id='+CloneOpp.id);


   system.debug('*name after update*'+colned.Name);
   system.debug('Source opp Name='+CloneOpp.Name);//this should be print TestNew but it prints CloneOpp


apex guide says-" If "opt_IsDeepClone" argument set to false, the method creates a reference to
the original sObject. Consequently, if you make changes to a field on the cloned sObject, the original
sObject is also affected".



please guide if any one has answer of this ..

After a lot of persistence I finally was able to get repeating header and footers when rendering a Visualforce page as a PDF. The key to this is the page2PDF support of CSS3. 


Here is the css I came up with:


<style type="text/css">

@page {

@top-center {

content: element(header);



div.header {

padding: 10px;

position: running(header);




In the visualforce page I have the header setup as a div with the class name "header" the position running command pulls the content in my div and repeats it at the top of every page. The key for some reason is to put your header and footer divs at the top before you put your content on the page.


Here is my page


<apex:page renderAs="pdf">


<style type="text/css" media="print">

@page {

@top-center {

content: element(header);


@bottom-left {

  content: element(footer);




div.header {

padding: 10px;

position: running(header);


div.footer {

display: block;

padding: 5px;

position: running(footer);



.pagenumber:before {

content: counter(page);


.pagecount:before {

content: counter(pages);





<div class="header">

<div>My Header Text</div>



<div class="footer">

<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>



<div class="content">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec nulla turpis. Suspendisse eget risus sit amet lectus ornare varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec urna purus, adipiscing accumsan massa. Nullam in justo nulla, sed placerat mauris. In ut nunc eget libero posuere luctus. Donec vulputate sollicitudin ultrices. Nulla facilisi. Mauris in sapien arcu. Phasellus sit amet quam non mi ornare tincidunt ac quis lectus.</p>




I cut the content text short for the purpose of this post. I am sure it will just take some more playing around.


Hope this helps someone avoid some late nights like I spent trying to figure this out. :smileyhappy:



Message Edited by JohnDS on 03-10-2010 07:34 PM
I have a custom Quote PDF page created last year before SF came out with their Quote object.  I'd like to edit my page to use it in place of the one SF has but when I try to modify mine to use the standard controller as shown in the VisualForce sample code, <apex:page standardController="Quote__c" showHeader="false" renderAs="pdf">, I get an error that "Quote__c" does not exist.  I've enabled the new SF quote object in my sandbox and renamed my custom quote object.  I've replaced all instances of my custom quote object in my QuotePDF page with "Quote__c" as in the sample so I don't know why it says it doesn't exist. 
  • January 28, 2010
  • Like
  • 0



I am creating a visualforce page, and want to set the tabStyle attribute based on Record Type.  However, when open the visualforce page with the following (where MyTabStyle is a string like 'contact', 'account', etc).





<apex:page standardController="Opportunity" extensions="myOppExtension" tabStyle="{!MyTabStyle}">



I get an error "Error: Invalid tabStyle '{!MyTabStyle}' specified. If you are trying to reference a custom Visualforce tab, you must append '__tab'".


Is setting the tabStyle this way supported?


Thank you