Add Print as PDF optoin in other module.

Hello all

I wnat to add Print as PDF option in stripe module and many more modules how can i plce this option in dropdown.

And where can i write the javascript code for the same.

Many Thanks.

i think you need to add button in

detailviewdefs.php of respective module

some thing like this


4 => 
          array (
            'customCode' => '<input type="button" class="button" onClick="showPopup(\'pdf\');" value="{$MOD.LBL_PRINT_AS_PDF}">',
          ),
2 Likes

Hello

i add that button but whne i click on it i gives error showpopup function is not define.

Where i place the code for that button ?

Many Thanks

look in

modules/AOS_Quotes/views/view.detail.php

you can extend the view by creating a file custom/modules//views/view.detail.php and extending the correct class for that module.

you will also have to add to the dropdown in the PDF templates module to include the new module.

here is how i did it.
for my custom module i created a file named view.detail.php in custom/modules/MyModule/views and added these lines

<?php /*if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');*/ require_once('include/MVC/View/views/view.detail.php'); require_once('modules/AOS_PDF_Templates/formLetter.php'); formLetter::DVPopupHtml('MyModule'); after that in custom/modules/MyModule/metadata/ditailviewdefs.php add 4 => array ( 'customCode' => '', ), after array ( 0 => 'EDIT', 1 => 'DUPLICATE', 2 => 'DELETE', 3 => 'FIND_DUPLICATES', quick repai rebuild and it works
2 Likes

Helllo

I follow your code byt when i add following line

formLetter::DVPopupHtml(“sc_StripePayments”);

that gives error which i attached please look it and give me solution if possible.

Thanks :slight_smile:

Forgot about something
In Admin->Dropdown Editor ->pdf_template_type_dom did u addyour module name and then go to pdf tempates and create a template?

Hi,
Don’t worry at all.
Here is the complete Guide to add Print to PDF feature to a Custom Module:

Print to PDF for Custom Module