Home › Forums › General discussion › Print image in a tab
- This topic has 9 replies, 2 voices, and was last updated 5 years, 11 months ago by Alexander Bautz.
-
AuthorPosts
-
-
January 9, 2019 at 13:32 #23401
Hi Alexander, when I print a tab where it contains an image inside a multi-line field the image is not printed any idea how to solve this issue?
-
January 9, 2019 at 19:34 #23421
Hi,
Are you using Insert > From Computer and adding the image to Site Assets?I’m working on an updated version of the print current tab code – can you try adding this snippet to your Custom JS and see if it makes any difference?
Alexander
- This reply was modified 5 years, 11 months ago by Alexander Bautz. Reason: Added missing link to code snippet
-
January 10, 2019 at 07:09 #23435
i tried both options to insert picture from SharePoint/Computer and still is not working.
which snippet should i add to my custom js, you didn’t send it. -
January 10, 2019 at 07:46 #23438
Sorry, I forgot the link – I have updated the post and added it.
Alexander
-
January 10, 2019 at 08:53 #23440
it didn’t work on explorer and chrome — error: spjs_path is undefined.
DFFS version: 4.4.3.58 — 4.46 —- 1.328 -
January 10, 2019 at 08:59 #23442
OK, the variable spjs_path is from the DFFS_loader.html – have you installed DFFS with the “local installer” or in another way?
If you didn’t use the local installer you can add a variable to the custom js like this:
var spjs_path = "/PathToTheSiteWhereSPJSisLocated/SPJS/DFFS/";
Change PathToTheSiteWhereSPJSisLocated to the actual path to your site.
Alexander
-
January 10, 2019 at 09:15 #23444
it worked but i lost part of my configuration print header and footer.
-
January 10, 2019 at 09:19 #23446
I’m glad it worked – the snippet I linked to was “work in progress” – try this one as it includes the custom header and footer:
spjs.dffs.printCurrentTab = function () { if (spjs.dffs.data.selectedTab === "") { return; } jQuery("body").append("<iframe id='dffs_print_form'></iframe>"); var iframe = jQuery('#dffs_print_form'), path, b = []; // Add default SP style sheet if (_spPageContextInfo.webUIVersion >= 15) { path = _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/" + _spPageContextInfo.currentLanguage + "/styles/themable/"; b.push("<link rel='stylesheet' type='text/css' href='" + path + "corev" + _spPageContextInfo.webUIVersion + ".css' />"); } else { path = _spPageContextInfo.webAbsoluteUrl + "/_layouts/" + _spPageContextInfo.currentLanguage + "/styles/"; b.push("<link rel='stylesheet' type='text/css' href='" + path + "corev4.css' />"); } // Add default DFFS style sheet b.push("<link rel='stylesheet' type='text/css' href='" + spjs_path + "css/dffs_frontend.css' />"); // Add DFFS Custom CSS b.push("<style type='text/css'>" + unescape(spjs.dffs.data.dffsDataObj.customCSS) + "</style>"); // Load files included above Custom CSS jQuery.each(spjs.dffs.data.requireCSSArr, function (i, cssfile) { b.push("<link rel='stylesheet' type='text/css' href='" + cssfile + "' />"); }); // vLookup CSS b.push("<style type='text/css'>" + unescape(spjs.vLookup.data.css) + "</style>"); // The below line will try to force Chrome so include backgrounds and colors to you don't have to turn it on in the print dialog b.push("<style type='text/css'>body{-webkit-print-color-adjust:exact!important;color-adjust:exact!important;}</style>"); // Header if (spjs.dffs.data.dffsDataObj.tabs.printHeader !== "") { pHead = spjs.dffs.buildValStr(unescape(spjs.dffs.data.dffsDataObj.tabs.printHeader)); pHead = spjs.dffs.translateStringWithJSON(pHead); b.push(pHead); } // Add formtable HTML b.push("<table class='ms-formtable dffs-print'>" + jQuery(".ms-formtable").html() + "</table>"); // Footer if (spjs.dffs.data.dffsDataObj.tabs.printFooter !== "") { pFoot = spjs.dffs.buildValStr(unescape(spjs.dffs.data.dffsDataObj.tabs.printFooter)); pFoot = spjs.dffs.translateStringWithJSON(pFoot); b.push(pFoot); } iframe.ready(function () { var contentWindow = document.getElementById("dffs_print_form").contentWindow; contentWindow.document.write(b.join("")); contentWindow.document.close(); setTimeout(function () { var printOK = contentWindow.document.execCommand('print', false, null); if (!printOK) { contentWindow.focus(); contentWindow.print(); } setTimeout(function () { jQuery("#dffs_print_form").remove(); }, 500); }, 1000); }); };
Alexander
-
January 10, 2019 at 09:24 #23450
okay great everything is working fine now i copied also the spjs_path and i will update my print function in DFFS_fronted_min.js file now.
thank you.
-
January 10, 2019 at 14:46 #23461
Thanks for the feedback. I will be replacing the current function with this in the next release of DFFS – hopefully during next weekend.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.