How to open hyperlinks in a new tab/window - pdf.js

The default behaviour of PDF.js is to open hyperlinks in the existing window. However, this may not be the desired outcome at all times. How can we open hyperlinks in a new window/tab and override the default behaviour?

There's a property called PDFJS.externalLinkTarget. This is set to NONE by default. Set this to BLANK and target='_blank' attributes are added to all anchors. That will open your hyperlinks in a new tab/window.
Possible values:
NONE [default]
SELF
BLANK
PARENT
TOP
Docs

In build/pdf.js, replace the line below:
target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
With this one:
target: _display_utils.LinkTarget.BLANK,
And then all links will always open in a new tab. I suppose you could pass it as a parameter. I never looked into how, because I wanted it to be permanent anyway, so hard-coded it.

Related

How To Set A New Default Tab As A Specific Spreadsheet on Google Sheets (Not As A Blank Page)?

How do I set a new default tab to be a specific spreadsheet that I made with formulas, etc.., so that every time I click a new tab, it opens up this specific spreadsheet, instead of a blank Google sheet page?
Is there a VBA code?
grab the sheet tab and move it to the front:
_______________________________________________________________
if this is a question about setting up a template as the default page for every newly created spreadsheet - that's not possible. templates are available for individual selection under this button:
_______________________________________________________________
to actually "clone" the sheet you will need to use a script. you can try something like:
function cloneGoogleSheet() {
var name = "labnol";
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Template').copyTo(ss);
/* Before cloning the sheet, delete any previous copy */
var old = ss.getSheetByName(name);
if (old) ss.deleteSheet(old); // or old.setName(new Name);
SpreadsheetApp.flush(); // Utilities.sleep(2000);
sheet.setName(company);
/* Make the new sheet active */
ss.setActiveSheet(sheet);
}
From my ad hoc trying, Google Sheet seems to determine the default Tab by the creation time. My simple solution is to copy/delete any Tab that is older than the desired new default.
For example, we have a Tab "New Default" that we want to set to the new default. Assume there are only a small number of Tabs (3 Tabs) created before the "New Default" Tab, and all other Tabs were created after the "New Default" tab.
(1) Create three new empty tabs.
(2) Copy over the three tabs created before the "new default" Tab,
so that we do not lose them. Then delete these three tabs.
Now the "New Default" becomes the default tab when open the link to the spreadsheet.
Note:
Of course, this approach has limitations and may need a script to do the copy/delete. Or even better if Google Sheet team adds support to set default though GUI directly.
Alternatives:
Before I came up with this low-tech solution, I also tried using a Google App Script .setActiveSheet("New Default") method on start. It works for the jumping; however, when people comment in the "New Default" tab, I got a notification in email. When clicking the comment, it jumps to the top of the default tab, which is annoying since it loses focus to the comments text.

How do I add a Web URL to a document using LotusScript

I have an agent that takes a copy of a template document and puts in values from a text file.
I am running into a problem when adding a hyperlink to a field programmatically, If I just add the text (e.g. http://www.google.com) there is no hyperlink just plain text. If I add the text manually, by editing the document just adding the address works fine and is clickable.
I have tried creating a rich text object then adding that to the field but that doesn't work either :(
Set rtItem = New NotesRichTextItem( doc, "link" )
Call rtitem.AddNewLine( 1 )
Call rtItem.AppendText ("http://www.google.com")
doc.AppendItemValue "Details", rtItem
To be clear, I'm looking for a way to append a clickable hyperlink to a field using lotusscript. Any help would be greatly appreciated.
EDIT:
Upon further inspection if I generate a document with a link in the text field and save it (programmatically using doc.save) it saves as plain text, as soon as I then go into this document and do a manual save the plain text turns into a link just fine. Could something be wrong with how I am saving?
If (Not doc.save(True,False,True)) Then
Msgbox("Document could not save")
End If
It does work the way you tried in your code with just "AppendText". But, the link works only if the document is in read mode and client property "Make Internet URL ... into Hotspots" is set.
UPDATE:
AppendItemValue doesn't work for RichTextItems.
Append the link direct to your field "Details" or if it doesn't exist then create it. Your code should look like this:
Dim rtItem As NotesRichTextItem
If doc.Hasitem("Details") Then
Set rtitem = doc.Getfirstitem("Details")
Else
Set rtitem = doc.Createrichtextitem("Details")
End if
Call rtitem.AddNewLine( 1 )
Call rtItem.AppendText ("http://www.google.com")

Devexpress : Express Printing System - Print contents of 2 cxgrid's

Actually, I never tried this but it's supposed to work judging from some comments I've read. I have two grids: One displays Hotel guests and the other one their former stays (Date from- date to, etc..). Now I would like to be able to print both contents as a single report.How do I add the linked contents of the second grid to my dxComponentPrinter1Link1 ??
In the IDE open your form.
Right click and choose ReportLinks on the TdxComponentPrinter
object.
In the links editor window, instead of clicking the Add button, click the dropdown arrow next to the Add button. Choose Add Composition.
This creates a TdxCompositionReportLink object. There is an Items property which will hold all of the report links you want in the composite report. This will print out as a single report. I can't promise both reports will be on the same page though. I've never figured out how to do that.

Firefox extension trying to insert chrome:// image into page

I'm working on a firefox extension and I am trying to make it add an image stored with the extension (the kind that you access using chrome://, although I'm not sure if there is an official name)
body.innerHTML+="<div style=\"position:fixed;top:0em;left:0em;background-color:white;\"><img src=\"chrome://tumblrscrollr/content/save.png\" /></div>";
This should put save.png at the top left of the page, however nothing appears there (not even the white background). If I replace chrome://tumblrscrollr/content/save.png with a url on the internet, the image displays properly. If I visit chrome://tumblrscrollr/content/save.png directly in the address bar, it displays fine. I assume there's some security thing or something going on that doesn't allow an img tag in a page to access an extension's files, but since google doesn't support symbols and any search for 'chrome' just returns the browser, I am finding it very hard to find any answer.
You need to use the contentaccessible flag for the tumblrscrollr chrome package, this will allow web pages to use its images. Meaning that your chrome.manifest file should have a line like this:
content tumblrscrollr foo/bar contentaccessible=yes
Note that this flag always has to be specified on the content entry but it affects any address starting with chrome://tumblrscrollr/ meaning also chrome://tumblrscrollr/skin/ for example.
Btw, you shouldn't add elements like that - this makes the browser to parse the entire document body again which is slow and might cause all kinds of side-effects. If you need to add a single element then just create that element and add it, e.g.:
var element = body.ownerDocument.createElement("div");
element.setAttribute("style", "position:fixed;top:0em;left:0em;background-color:white;");
element.innerHTML = "<img src=\"chrome://tumblrscrollr/content/save.png\" />";
body.appendChild(element);

RefineryCMS - remove default page parts

I want to remove the side_body section on each page in RefineryCMS.
The guide advises that you can change page parts by going into config/initializers/refinery/pages.rb and altering the settings:
So I have changed:
config.default_parts = [“Body”, “Side Body”]
to:
config.default_parts = [“Body”]
I have restarted my server, but my side_body section still appears. Can the side_body be removed?
It is just a guess, but I believe that it only appears on already existing pages. If you create a new page, you should only see the Body-tag. At least this was the behavior in Refinery 1.0.8.
To remove the Side Body from already existing pages, you will have to make the pageparts editable. I think you can achieve this by setting config.new_page_parts => true. After that, when you edit the page, you should be able to see a (+), a (-) and a (reorder)-sign right above the editor.

Resources