PhantomJS AWS Browser Tab Title - pdf

I have a problem with my browser tab title.
Actually on my website I generate some report using PhantomJS and pull them on a AWS S3 Bucket. I access to them using some link like that : http://192.168.33.120/report/8/1?export=inline
The problem is that my Browser tab titles are like : 1 or 1?export=inline, it display the url and not my PDF file name.
Is that possible using PhantomJS to set a property like title or other think like that to specify the title that I want to show on browser view ?

The title of the rendered PDF cannot be explicitly set. document.title is also not used for the PDF title. Although, qpdfwriter.h has a setTitle function. You can issue a feature-request on GitHub to expose this function if you like.
You can also simply name your reports appropriately by selecting good URLs. That way the PDF title will be a non-issue.

Related

How do I render a PDF from HTML with working named anchors?

Is there a way for a bunch of named anchors in a large html to be clickable within a PhantomJs generated PDF file?
I.e. say I have a table of contents or a list of FAQ questions. When clicking on the question/title - I'm taken to its answer/content within the same HTML file which is great but when the same HTML is rendered into a PDF each named anchor becomes an absolute URL (i.e. http://example.com/render.html#anchor_1) so clicking on it opens a browser with that URL instead of jumping to its content within the PDF file.
So, basically, is it possible (and how?) for a markup like this - https://fiddle.jshell.net/jyjuaaog/ to work within the generated PDF?
BTW, this works great when "printing as a PDF file" in Google Chrome but links end up broken when rendered in PhantomJs so there must be something I'm missing that I can't seem to find in the docs.
Any ideas?
Thanks!
Apparently there's a bug in PhantomJs preventing this. As suggested by PhantomJsCloud a quick-and-dirty workaround would be to replace the links with page links.

generating streaming link api

i want to know how to use google api, can anyone give some example using php.
eg. use api to get picasa album rss.
Any help is appreciated!
For that you have to embed the video in your html with an iframe and a url like this:
<iframe src="https://drive.google.com/file/d/{videoID}/preview" width="640" height="480"></iframe>
Just change the {videoID} for the id of you video.
To get that code from Google, you should follow the next steps:
Open the video in your Drive.
In the top right of the view, you will see an icon that says "Pop-out", Click on it.
It will open the video in a new tab.
In the new tab click on the icon of the three dots that says "More actions" (in the top-center).
Select the option that says "Embed item...". You will see a popup with html code.
In general, there is no way to "predict" or "construct" a direct link to your Drive file. The supported method of getting the link is to use the Drive API. If you make an HTTP request to the file metadata endpoint https://www.googleapis.com/drive/v2/files/{fileId} with a valid API key, the webContentLink value should be the googleusercontent.com URL for your file.
You can try this out on the Google API Explorer - drive.files.get to see all of the information which is available through the Drive API.

How to add a custom image (<xh:img>) to PDF

We would like to add an image to our PDF in Orbeon. We explorered different tags and came up with tag. This worked the way we wanted but this tag keeps the PDF from building. We don't get any (visible) errors but a time-out occurs after couple of seconds.
To cross check: PDF build fine without the xh:img tag.
I was wondering what other options do we have. I thought about a PDF template but we would like to give the form author the option to choose his/hers own jpg from a web resource.
This is on 43PE.
User error yet we didn't change much after all.

Checking the contains of an embed tag using Selenium

We generate a pdf doc via a call to a web service that returns the path to the generated doc.
We use an embed html tag to display the pdf inline, i.e.
<div id="ctl00_ContentPlaceHolder2_ctl01_embedArea">
<embed wmode="transparent" src="http://www.company.com/vdir/folder/Pdfs/file.pdf" width="710" height="400"/>
I'd like to use selenium to check that the pdf is actually being displayed and if possible save the path, i.e. the src link into a variable.
Anyone know how to do this? Ideally we'd like to be able to then compare this pdf to a reference one but that's a question for another day.
As far as inspecting the pdf from selenium, you're more or less out of luck. The embed tag just drops a plugin into the page, and because a plugin isn't well represented in the DOM, Selenium can't get a very good handle on it.
However, if you're using Selenium-RC you may want to consider getting the src of the embed element, then requesting that URL directly and evaluating the resulting PDF in code. Assuming your embed element looks like this <embed id="embedded" src="http://example.com/static/pdf123.pdf" /> you can try something like this
String pdfSrc = selenium.getAttribute("embedded#src");
Then make a web request to the pdfSrc url and do (somehow) validate it's the one you want. It may be enough to just check that it's not a 404.

How to load two websites in one page?

I don't want to use frame or iframe because most websites are busting it nowdays.
what are the possible methods to do this?
The intended behaviour is as if like two browser controls loaded in a website.
What is wrong with an iframe? What do you mean by busting (lots of websites are full of iframes)? You do not want to use iframes within an email but that is a different point!
The advantage is when people click on links within an iframe the content of the iframe gets refreshed, while if you pull the content of a webpage and then display it within a div the user will be moved on loosing the rest of the page.
you can pull it via script (PHP / curl) and display the code from there.
or you can use good old frames, although i wouldn't recommend it.
If you do not want frames, then another option is to do it server side - make your server access the pages and combine them into one response stream.
You can also so this client side using Javascript and DHTML
fopen() returns a file pointer:
$file = fopen("http://www.site.com/", "r");