Announcements
No record found.
Hi All,
I need to print an offline HTML file in filed service mobile app(Resco App). I have used the following function.
function print() {
var service = new MobileCRM.Services.DocumentService(); service.print("file://OfflineInvoice.htm", false, MobileCRM.bridge.alert, null); }
But when I try to print it does not show dynamic content of the file.
Output
Expected output
Could you please help me to resolve this issue?
Thanks
Ajith
Are you trying to print a mobile report?
I think the service.print function just reads a file and prints it, it doesn't dynamically create the report.
Are you creating the report before you print the file?
Hi Thomas,
I am not using a mobile report. I have created a custom offline js and I need to print it. Before, print I am creating a report.
when print button click, I need to print the report.
Maybe you need to save the html file with the populated data before you print. Its hard to say.
Is it possible to see your code?
How can I save the HTML file? I can send you the code using LinkedIn because It is bit large file to copy here.
Hi Ajith, yeah you can send it to me via linkedin. Ill try and have a look when I have some free time
Thanks. Could you please tell me, how can I save HTML file?
I dont know exactly needs to be coded in terms of syntax.
But I assume you are writing the dynamic values to a html DOM and once you have done that you just need to save that html DOM somewhere locally then you can print the file.
Hi Ajith
can you send the .js file with code, i am curious to ser how you have written the code.
Hi Akelan,
How could I send the file to you?
Thanks,
<body onload="show()" id="printJS-form"> <table> <tr> <th> <img id="img-logo" width="200" height="100" /> <br />Confirmation of Service <br />TAX Invoice <br />.................................... </th> </tr> <tr> <td></td> <td></td> </tr> </table>
<body onload="show()" id="printJS-form">
<table>
<tr>
<th>
<img id="img-logo" width="200" height="100" />
<br />Confirmation of Service
<br />TAX Invoice
<br />....................................
</th>
</tr>
<td></td>
</table>
<!--<p><button onclick="show()">Generate Invoice</button></p>--> <p><button onclick="cal()">Calculate Invoice Total</button></p> <p><b>JOB DETAILS</b></p> <span id="JobDetails"> </span> <p><b>SALES DETAILS</b></p> <p><b>Product</b></p> <span id="product"> </span> <p><b>Services</b></p> <br /> <span id="service"> </span> <span id="product2"> </span> <span id="product3"> </span> <img id="img-result" width="200" height="100" />
<!--<p><button onclick="show()">Generate Invoice</button></p>-->
<p><button onclick="cal()">Calculate Invoice Total</button></p>
<p><b>JOB DETAILS</b></p>
<span id="JobDetails">
</span>
<p><b>SALES DETAILS</b></p>
<p><b>Product</b></p>
<span id="product">
<p><b>Services</b></p>
<br />
<span id="service">
<span id="product2">
<span id="product3">
<img id="img-result" width="200" height="100" />
<!--//<p><button onclick="print()">Print</button></p>-->
<button type="button" onclick="printJS('printJS-form', 'html')"> Print Form </button></body>
<button type="button" onclick="printJS('printJS-form', 'html')">
Print Form
</button>
</body>
Above is the HTML that Ajith sent me via LinkedIn. I have removed the JavaScript which populates the HTML dynamically. (The code looks fine). I think the issue here is that when you go and print the file it only reads the html stated in the code above, it doesn't include your values that you have added dynamically as this is only added in real time on the front end, this is not saved to the file directly. Once you have populated the html with your values, somehow you will need save the html generated as a file and print this file instead.
This part i'm not so sure to achieve as I haven't done this before. Maybe a quick google can put you in the right direction like below:
https://stackoverflow.com/questions/8792950/how-make-a-dynamic-or-generated-html-page-savable
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 44 Super User 2026 Season 2
Travis South 41
Ayesha Wajahat 18