How do I make a jspdf autotable landscape? - jspdf

The table plugin JsPDF-AutoTable: https://github.com/simonbengtsson/jsPDF-AutoTable how do I make the page landscape as oppose to portrait? In the documentation it just says "Only pt supported (not mm or in)". I don't understand how to make the page landscape; landscape makes sense for a lot of tables....

Ok the answer is: var doc = new jsPDF('landscape');
It would be helpful if this was in the documentation.

I have done it initializing jsPDF instance like this:
var doc = new jsPDF('l', 'pt');
Here, l means Landscape format. For portrait, p can be used.

Related

How to restrict Youtube player fullscreen still within the window, I don't want to have real fullscreen

I have the awesome config like this below:
{ rule = { instance = "plugin-container" },
properties = { floating = false },
callback = awful.titlebar.hide },
I don't want to have my Youtube fullscreen really playing fullscreen, but instead it is playing within the window size. If I want to have fullscreen, I could do with Win+F shortcut.
With the config above it doesn't work. Whenever I click fullscreen, it is really playing fullscreen.
I am used to be an Ion3 user and in Ion3 it just works. I am wondering whether it is possible for Awesome to do like that?
Many thanks.
You can do that on the src attribute of your iframe by adding fs=0 parameter
<iframe w src="//www.youtube.com/embed/video_id?fs=0></iframe>
Parameters doc
I know this is old but found this while asking a similar question just now. Not sure it helps you much since I think you were trying to do the same thing I am (make it a permanent feature by adding something to rc.lua), but if you click YouTube's fullscreen button or have VLC fullscreen itself or whatever and THEN Super+F you will get the effect you want. It will defullscreen into its previous window size but the client still thinks it is in fullscreen mode.
Untested
client.connect_signal("property::fullscreen", function(c) if c.instance == "plugin-container" then c.fullscreen = false end end)

Highcharts exporting error?

I've just upgraded my site to the new 3.0 release.
The charts shown on my site are 990x548 pixels.
But when I select an export, regardless of whether it's png/jpg/pdf/svg, the output is 1020x930pixels.
Is this a known bug, or might I be doing something wrong?
Thanks!
Yo can define width / height exported image by chartOptions parameter.
http://api.highcharts.com/highcharts#exporting.chartOptions
the exportButton and printButton are now removed, and replaced with a generic contextButton. So you can use that one for your dropdown menu: http://api.highcharts.com/highcharts#exporting.buttons.
See also the new article at http://docs.highcharts.com/#export-module
Please refer my question
Highcharts 3.0 version changes in exporting options?
The problem was that I didn't have an explicit width set on the chartContainer div. I was just letting it flow to 100% of the parent element. As soon as I set an explicit width on that div, the exporting size options worked. Before that the chart would come out squished regardless of what documented options I set.

Blackberry: Creating a ListView or TableView like screen in Blackberry

I'm not sure where to begin, but I've been trying to find a similar class that allows me to create a scrollable list where I can add images and text.
I found a tutorial using PictureScrollField, but I dont think that is what I need. Is FlowFieldManager the closest thing?
Edit:
I see that there is a tableView class in Blackberry. However, it says BlackBerry API 6.0.0, so does that mean it won't work with bb's 5.0?
For BlackBerry, typically you use a ListField to build a scrollable list. It does have some constraints though: Each item needs to have the same height, and you have to do all the drawing yourself, instead of using the more typical field + manager layout used for BlackBerry screens. The upside of those constraints is that the drawing performance is quite good.
I used FieldManager classes to do this. As an example you can use:
net.rim.device.api.ui.container.VerticalFieldManager.
And for images I have used following kind of code.
InputStream inputStream = connection.openInputStream();
byte[] data = IOUtilities.streamToBytes(inputStream);
EncodedImage img = EncodedImage.createEncodedImage(data, 0, data.length);
img.setScale(3);
imgOK.setImage(img);
In following link some specified Layouts are available OS5.0 also
like table view,grid view and spreadsheet layouts
just copy paste that class into your project then you can use this
using TableModel-TableView-TableController
GridTable-SpreadSheet-layout-manager
if it is not useful to you just ignore this

iOS printing a PDF via printingItem appears to add a blank header; can it be removed?

I am using iOS 4.3 and Apple's suggested method for printing a PDF, which is to set the shared UIPrintInteractionController's printingItem property to an NSData object containing PDF data. It's very easy, which is great, but I've found that when printing a PDF via this method, the content starts 4mm lower on the page than if I print via Preview.app on my Mac. As I am printing to pre-cut labels, precise positioning is important.
It appears that somewhere in the process, a (blank) header is being added to the page, which is causing the content to shift down the page. The resulting horizontal margins are the same on both iOS and Mac OS X so I suspect it really is a header, and not an all-around margin.
I have checked the following:
Is the printer adding the header? No, because the same results can be seen when printing to the Printer Simulator.
Is the iPad using a different paper size to the Mac? I have used the delegate method to ensure that the UIPrintPaper is the same for both.
Can I edit headerHeight for the UIPrintPageRenderer? No, because a renderer is not created when setting a printing item directly.
My workaround is to make the PDF generator (the server) create the PDF content 4mm higher up than it ought to be, but this breaks printing from Mac OS.
Out of ideas now! Thanks for any assistance.
You should check Apple's sample code PrintWebView. I believe the problem your having is because of the hardware margins. See SIMPLE_LAYOUT constant in PrintWebView sample to learn more. Hope this helps.

Open Flash Chart - tooltip #x_label# not showing

I'm currently playing with a bar chart implemented through Open Flash Charts (I believe version 1, might be version 2...) with PHP. Unfortunately, we're having real trouble with the tooltip not showing the correct thing. I am trying to get it to show the x-axis label for the hovered-over column, then a ":", then the value of the bar. The code is as follows:
$Colour = '#3465A4';
$BarChart= new bar();
$BarChart->set_values($Bar);
$BarChart->set_colour($Colour);
$BarChart->set_tooltip('#x_label#:#val#');
$x_labels = new x_axis_labels();
$x_labels->set_labels($Roles);
$x_labels->rotate(-60);
$x = new x_axis();
$x->set_labels($x_labels);
$chart = new open_flash_chart();
$chart->add_element($BarChart);
$chart->set_bg_colour( '#FFFFFF' );
$chart->set_x_axis($x);
$tooltip = new tooltip();
$tooltip->set_hover();
$chart->set_tooltip($tooltip);
$JSONArray['my_chart_1'] = $chart->toPrettyString();
As far as I can tell, this should be correct - the bar chart appears, with the correct values (populated from $bar, whose generation is not shown above). However, the hover-over tool-tip for a column only shows ":value" - the label name is missing!
Does anyone know where we might have gone wrong, and how I can fix it?
EDIT:
An update for any Bounty Hunters coming in to try and answer this question. The reason I have not accepted the below answer is that it only provides a work-around, and does not explain why the work-around is necessary. I am looking either for an answer to my original question (how to make the labels show in a normal bar-chart), or a reasonable explanation regarding why one must use a stacked bar chart (including sources makes your answer so much better!). If the latter, example code or an explanation of how stacked charts are created would be much appreciated as well!
If you are happy with the simple bar visuals then use stacked bar (using it with an array of one element will draw it just like the simple bar). That one will replace #x_label# correctly.
Alternatively you can copy the missing code from Bars/Stack.as to other bar types and recompile the code.
As per: http://forums.openflashchart.com/viewtopic.php?p=7433#p7433
It's a bug in OFC2 in the latest versions (at least). I've found what is causing the issue with #x_label#, but my understanding of the code/Flash isn't good enough to know why it's happened/broken.
I've done a quick fix that I need to test some more, but it now works on bar charts. Assuming I've not broken anything else beyond repair, it'll make it's way into the next community release.
If anyone wants the source code changes before the next release let me know.
(I am currently maintaining the community releases)

Resources