wkhtmltopdf internal links - hyperlink

I am using wkhtmltopdf to generate reports from my html templates, i am trying to generate an index for the output PDF.
The thing is that I want to achieve similar functionality to the indexes of microsoft word.
For this purpose I need to use several internal links among the document, so when clicking in the index of the PDF, it goes to page 10 for example.
Any clues about how to achieve this?
I am using wkhtmltopdf version 0.11.0 rc2 in Windows, but sooner or later I will have to move it to linux so I need a compatible solution among operating systems.
Thanks a lot in advance.

I got the solution by my self, but i just haven't check compatibility with Linux.
For achieving the internal links you add in the html:
Target of the Link:
<a name="name_of_target">Content</a>
Link to the Target:
Link Text
It works perfectly when converted to pdf.

It can be tricky. E.g. invisible (empty) links don't work as targets. Also, the structure seems to matter and not all valid html5 layouts work. E.g. I found that while this works:
<h2><a name="name_of_target">Target</a></h2>
this does not:
<a name="name_of_target"><h2>Target</h2></a>
Despite both being perfectly valid (in html5). (I'm using version 0.12.6.)

I had the same issue with wkhtmltopdf
wkhtmltopdf 0.12.2.1 (with patched qt)
with debian 9 installed with the package.
wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
I enabled the internal links with the command option
--enable-internal-links
I used the target:
<a name="name_of_target"><div><img src="image.png">Content</div></a>
and the link
Link Text
But still not working, other link in the document worked well.
Then I replaced the div with a span and it worked.
<a name="name_of_target"><span><img src="image.png">Content</span></a>
The issue is related with the display block rule of div elements. When I added display block rule to the span the link not worked again.

Related

Cordova white screen of death iOS - browserify, react, cordova

I have a strange situation with a project for iOS.
Its created using browserify and React for Cordova and aimed at iOS.
We have built the project for iOS using Cordova commands without any issues. It runs with no xcode errors or Javascript errors either however none of the JS ui appears on screen. We just get a blank white screen with the system bar at the top. See attached screen shot.
So far we have found out that if you add HTML to the index.html in WWW folder it prints that fine so I assume its the JS.
When we run in a browser it works as well as building for Android.
We have no problems with anything other than iOS (simulator and device build).
hopefully someone can help me out here because I'm stumped. Please let me know what files you need to look at and I'll make them available.
Thanks in advance.
IMAGES
The error screen: http://www.voidapplications.co.uk/errorScreen.png
What we expect to be shown: http://www.voidapplications.co.uk/whatWeExpect.png
If you are using internationalization component that's because you need to use the Intl polyfill:
Intl.js and FT Polyfill Service
Intl.js polyfill was recently added to the Polyfill service, which is developed and maintained by a community of contributors led by a team at the Financial Times. It is available thru cdn.polyfill.io domain, which routes traffic through Fastly, which makes it available with global high availability and superb performance no matter where your users are.
To use the Intl polyfill thru the Polyfill service just add one script tag in your page before you load or parse your own JavaScript:
<script src="https://cdn.polyfill.io/v1/polyfill.min.jsfeatures=Intl.~locale.en"></script>
When specifying the features to use thru the polyfill service, you have to specify what locale, or locales to load along with the Intl polyfill for the page to function, in the example above we are specifying Intl.~locale.en, which means only en, but you could do something like this:
<script src="https://cdn.polyfill.io/v1/polyfill.min.js?features=Intl.~locale.fr,Intl.~locale.pt"></script>
note: the example above will load the polyfill with two locale data set, fr and pt.
This is by far the best option to use the Intl polyfill since it will only load the polyfill code and the corresponding locale data when it is really needed (e.g.: safari will get the code and patch the runtime while chrome will get an empty script tag).
source & other ways to include Intl polyfill: https://github.com/andyearnshaw/Intl.js#getting-started
You can debug the UIWebView in the simulator with Safari http://moduscreate.com/enable-remote-web-inspector-in-ios-6/. You'll probably see a big error message in the console, if not you will have access to the debugger so you can step through and sort it out.
I have had this issue in the past, it turned out to be unsupported javascript features. for example, setting default parameters in the function. I.e:
function test( myvalue=0 ) { /* ... */ };
I had to initialise the value inside the function instead. You could also try removing any ecma script 2016 features you may have implemented.
Trouble shooting this type of issue was painful. I created a minimal version of the smallest part of my product compiled and ran it on ios emulator, added another chunk of the product, rinse and repeat.
Im sure there's a better way to detect these issues, but I do not know it.

MVC 5 With Tinymce Editor Contain Words "FIND", "SERVICES" and some more around 8 more letter "ERR_CONNECTION_RESET"

recently i am facing problem on my all MVC applications using TinyMce editor i am using that editor to allow users to input content of the page, strange things is happening now. when ever they have type following word in content.
"find", "services","replace" and some 8 more character inside editor, and when we hit safe button immediately after server giving me following error.
This webpage is not available
ERR_CONNECTION_RESET
as far for me this is Firewall problem. but i need to know if someone have same problem how can we explain network people?
The error clearly indicates as you mentioned that this is an internet problem as it suggests webpage is not available. There is a video here that indicates you may need to reset somethings on your network. Checkout if that helps.

Markdown Here browser plug-in syntax highlighting is not working in Chromium or FireFox. Works on Chromebook

I tried the following:
```tex
\includegraphics[width=200px]{untangler_manual_development_history_before}
%% This is a comment %%
```
but it only gives me a block of text, with no syntax highlighting, displayed in the picture below. The same is true for Java and other languages - Markdown Here renders a block of plain text without any highlights.
Any suggestions? Am I missing something? I tested this on Chromium and Firefox using Ubuntu 14.04, and the syntax highlighting does not work. On Chromebook, the syntax highlighting works just fine.
If this is a legitimate bug, any suggestions about how to file it would be great. I could not find the appropriate Markdown Here, and this site was the closest support I could find, but there is no option to file a bug.
Here is a picture of the rendered Markdown on my example above:
Note that there are many different flavours of markdown around.
If the "GMail Chrome plugin" you're using is Markdown Here: it apparently makes use of highlight.js which supports tex. So it should work. It's even in Markdown Here's source code. Are you sure you're using the latest version of the plugin?
I too was affected by this problem, using Ubuntu 14.04, in both Thunderbird and Chromium.
I eventually fixed it simply by opening the Markdown Here preferences page, and changing the drop-down in the "Syntax Highlighting CSS" section from "Currently in use" to "Default (Github)".
Find the preferences in Chromium:
Menu->Settings->Extensions->Markdown Here->Options
And Thunderbird:
Tools->Add-ons->Extensions->Markdown Here->Preferences
I should add that I'm using Markdown Here version 2.11.2.

Firefox add-on doesn't work with tag <em:updateURL>

I have a custom Firefox add-on. It worked ok, until we decided to make it self update-able.
According to manuals at mozilla.org, there should be an <em:updateURL> entry in add-on's install.rdf, containing a link to some update.rdf. Seems pretty simple.
But, when I add <em:updateURL>some_url</em:updateURL>, the add-on doesn't work. I use Netbeans IDE with Foxbeans plugin for development, and when I run add-on project from this IDE, Firefox runs with this add-on switched off (and switching on disabled). When I compile the XPI and add it to Firefox (3.6.12), it says about version incompatibility and doesn't work either. Doesn't matter, if I use http or https in the updateURL.
If this tag is empty, like this: <em:updateURL></em:updateURL> , everything works (but doesn't update itself, of course)
The solution was quite simple, though not obvious at a first glance.
In install.rdf <em:updateURL> should be after <em:targetApplication>, not before.
Hope this would help somebody, sometime.

Firefox extension: Embed javascript in a webpage

I want to insert some script into every page, which have some functions that will be called by the modified HTML of that page, using a Firefox extension. I am able to insert the JavaScript into the head of the HTML, and also modify the page, but the java script functions are not called by the onmouseover event.
Does someone has any pointer on how to do that, using java script in local extension or as a online resource.
No GreaseMonkey, I need to do it with my plugin and not ask user to install greasemonkey, my plugin and the scripts.
Greasemonkey does this. It's excellent!
Make a Greasemonkey script. See Userscripts.org for lots of example ones to work off.
Why not use Greasemonkey? It allows you to execute javascript on any page on Firefox, and if executing the code you enter isn't good enough you could dynamically add links to the head, too.
you can modify the DOM using Firebug. I am not sure if you can load files locally.. sounds malicious. Also, you can just run arbitrary javascript commands in the Firebug console (a la python/ruby console)
There are some Greasemonkey-to-extension "compilers" (or extension-wrappers) out there:
Arantius's GM compiler
Gina Trapani's multiple-GM-script compiler
I've used the first one with extensive internal tweaking over time. However, I don't believe the compiler is actively maintained (default max-version is only 3.0), so may not be up-to-date with the latest GreaseMonkey, or FireFox.
I think Gina Trapani's is more designed for multiple scripts targetting the same domain, but I haven't used it.
Neither of these is a "GreaseMonkey solution" per se, as the end-user never has to install GreaseMonkey. They get a real-live FireFox extension. The core is very similar to GM, but you can change or add as much as you like.

Resources