I am working on an enterprise wiki site collection , and using the SharePoint designer I have manually added a link named “Print to PDF” as follow:-
But I am trying to implement the link functionalities, so when the user clink on the link, the page content (mainly any html components that are inside the rich text ) should be displayed inside a pdf file?
Can anyone advice how I can achieve this ,, can I write a javaScript code which can do the work ? Thanks
You can develop an ASPX page (actually preferably an ASHX handler) that does the work for you by accepting an URL to convert, which you then pass into a third party HTML to PDF library. The generated PDF file can then be returned to the user's browser.
Alternatively, have a look at this blog post (that I wrote, so big fat disclaimer about me being biased) that shows how you can buy a product off the shelf that does all the work for you.
You can read more about it here.
BTW, for questions related to SharePoint you may want to consider using sharepoint.stackexchange.com.
Related
I am trying to make a simple form submission in a GitHub Repository.
Basically what I want to do is take the input of an HTML Tag and then store it in another local file such as another HTML file or a text file without a back-end.
I understand that there was a saveAs function within JavaScript (however I read that it had been discontinued due to security reasons). Once I get the data stored in a file I would call it in the HTML page with the < embed > tag to show it on the page. So basically I want the Input on the page, and then when it is appended to the file, to show up on the same page again when the page is refreshed. My reason for doing this is to make a make-shift Google WorkSpace-like page for my production studio.
Here's a visual of what I want to do:
HTML PAGE:
Embedded File Contents (externalfile.html) Go Here.
Input: Input Goes Here
Submit
When Submit is pressed, it takes the contents within the "Input Goes here" box and appends it to "externalfile.html", then when the page is refreshed, it shows the updated content above the form.
I am not well-versed in JavaScript but I know JQuery a Good bit from making a few websites with Wix, but I do not know much native JavaScript nor it's functions. Any advice would be helpful. :) Thank you. I would be adding multiple input boxes and such on the page.
Hello and welcome to StackOverflow!
Now, if I got your question right, you want to append something to a file and read this file without using any backend? Then I must disappoint you, because there is no way JavaScript allows this, since it would be a tremendous security risk. The reason is, because any malicious JavaScript code on any webpage then could not only create malware files on your PC and dragging it to some start up folder, but also they would be able to read all the files and documents on your machine (without your knowledge!). So I think you see where the problem is.
For your task I recommend you using some kind of backend (i.e. NodeJS, PHP) and make things work with API requests and asynchronous JavaScript. Or you could serve your site with an ExpressJS backend and statically fetch the request and append its contents to a file. Then of course send an HTML file back with all the inputs the user made. The choice is yours.
Cheers
I am currently working on a custom URL shortener and am trying to figure out how to "inject" my own social preview metadata dynamically for each page. (eg. for Twitter Cards) I had originally planned on doing this in much the same way as I am with the actual redirect, fetching the data using the JavaScript fetch API. After reading a little more though it does not appear that this approach will work since it doesn't look like the twitter (and other social media web crawlers) run JS when looking for the metadata.
Is this correct?
If so, is there a way I can load the metadata from a dynamic source instead of just having to create a new html file for every redirect?
It looks like I can probably do something, at least for the image based on a test of this link (using https://source.unsplash.com/random for the image) through the twitter card validator. But what would be the best approach to doing something similar? Everything I can think of would use JS.
I have similar pages in production.
You'll need to use a server-side language (like PHP, or node.js) to set the meta tags for your twitter cards, and use javascript to redirect the page.
I manage a small web page for a relative's business. They want to provide notes on the page for the visitors regularly (opening times, news etc.) but cannot code the web page themselves.
Is there a way to embed a news scroller, text field, whatever on the page - however, the text displayed there then comes from an external source they can manage like a htm, txt, json (whatever) file hosted e.g. on their Google Drive that they simply need to change and see the edits directly in the web page (the file would be public; the URL to be embedded in the web page code).
Is there a solution or an easier way to achieve it? thx
You can use file_get_contents() if I got you right.
To achieve this, first you need to create a portion on the website to display the news or whatever external dynamic content you want.
Then you need to develop complete APIs for that site and then hit them from your website (Keep a secret key for safety). Your API can do everything you program it to do. (E.g You can put the news in database or create publicly accessible files through it)
When this is achieved, you can then fetch the data into the portion created for news etc. (automated through programming)
Using PHP you can achieve all the above mentioned steps.
That way you will just have to push/send the data from your APIs and the actual site will keep getting updated without any further action required.
Hope that helps.
If they can write the HTML and make it available at a public URL, you can simply embed it using <iframe> in HTML.
I am currently developing a RESTful based service where I call the OneDrive API to store and retrieve Word documents. I can also generate a so called "shared edit link (shared_edit_link)" or a "shared read link" (shared_read_link) which points to uploaded Word documents and this allows me to give the shared link to anyone so they can edit the Word document. Works great.
When you open the shared edit link you see the OneDrive online Word editor with the document with in the header buttons for signing in and sharing the document to OneDrive.
Question: is it possible to change the layout of the OneDrive Word editor with a custom logo/branding and/or is it possible to remove the buttons for signing in and sharing the document? I would like to only show the document with the Word functionality, preferably nothing related to signing in or sharing to OneDrive.
Short answer, no.
Long answer, what you want sounds like your own online document editor. So, it is certainly possible to get the document content via API and then insert that into your own custom editor that you built. But there is no way to programmatically alter the provided OneDrive/Office Online/Word editor to remove branding, etc.
I have written a HTML code of 300x200 dimension. Now my client wants that the code must fetch from a server and show it to the site they add the code.
We need to add this advertisement to approx 30-40 sites and the content will be changed after 10-15 days so replacing he content on these sites again and again will be pain.
So, I am thinking on adding this code to server/host and fetching and displaying to the website.
I am thinking of using a js script. But I have no idea how I can achieve it.
P.S. I have search on internet but I am not getting a proper keyword or what should I search for.
Can you help me in this thing?
The code will be implemented on blogging websites and wordpress websites.
Thanks
Host your dynamic PHP page (which shows your advertisement) on your server.
Then you have a few options to display it on other websites:
Use JavaScript and include a .js file from your server (same php page, which outputs Javascript), and either use document.write or change the content of a div through a function
Use an iFrame and directly display the PHP page