I am going through jsPDF. while it seems like a good library it is missing good documentation.
I have written a pretty simple code but it doesn't seems to print anything. Everytime it generates a blank pdf. Below is my code, if any one have any idea please help me out.
<script>
$(document).ready(function() {
var pdf = new jsPDF('p','in','a4')
pdf.setFontSize(40);
pdf.text(35,25,'vvdfv sdv sdf sfdsf df sfsf')
pdf.save('dynamic pdf-examples.pdf');
});
</script>
The problem here is you've set your units to inches and 35 inches is way off the page. You can either change your unit of measurement (to mm perhaps?) or lower the numbers.
You're right about the documentation - it's something I'm going to be working on soon.
Related
I've been working on a Skrollr site but it appears to be getting excessively jerky. I've had dev tools open and have found a few really really slow frames, but I don't have the knowledge to track down exactly what is going wrong.
My observations are:
it is slower scrolling down than up
intermittently it is absolutely fine
So far I have tried a few things
Given the first segment a translateZ value to try and separate out the paint (I have no idea if this is correct – I'm really at the limit of my knowledge!)
Had a go getting rid of the relative animations (data-top-bottom etc) which could well be slowing things down, but after changing everything back to static numbers (data-1000 etc) its still almost identical
Can anyone shed any light on this? The URL is http://fieldviewfestival.co.uk/500 ... power up!
I think I've fixed it!
The webfonts weren't fully loaded when skrollr kicked in. After initializing it I added a
$(window).load(function(){
Where I refreshed skrollr I then added the following:
s.refresh();
I think the main problem was that the height of the page wasn't calculated by the time skrollr kicked in.
Also I had a strange scrollbar left over (so a scrollbar on the body AND html), which skrollr hadn't removed so I also added above that function
$(window).trigger('resize');
The final initialize looks like this:
var s = skrollr.init();
$(window).load(function(){
// console.log("Loaded");
$(window).trigger('resize');
s.refresh();
});
NB Silly miskate I made as well, don't use the function $(document).load(
I'm a newbie looking for help.
What I want to do is this:
I have about nine projects listed on my home page each with a large image. Each project has about five other unshown images.
I'm trying to figure out how to click on the main image and have it load the next image in its place, staying on the same page, no transition needed. I have text links to the side to also control 'next' or 'previous' images if you click on them.
I'd like the images (aside from the nine initial) to load as you need them, so I'm not loading 50 images right from the start.
I'ts also been a headache trying to make nine independent gallery/slideshows on the same page.
Right now, I'm using a bloated, messy javascript that I hacked together rto get it done, but its unstable across browsers and I feel like it has a LOT of unnecessary code. So I won't bother posting it, I think I need to start from scratch.
I feel like this should be relatively simple but I can't find any plugins or examples anywhere that do this simple task.
I'm a total amateur, but I'd love to learn how to actually code it, so if anyone knows of any tutorials out there that could help me, I would really appreciate it! I have in my head that it should just be some simple jQuery, but I'm not sure exactly how to do it.
Thanks for any help!
If you must reinvent the wheel, here is a bare bones simple example:
http://jsfiddle.net/KDnPX/
Html:
<img src="">
Previous
Next
Jquery:
var json = '{"0":"http://mw2.google.com/mw-panoramio/photos/medium/14748463.jpg",
"1":"http://mw2.google.com/mw-panoramio/photos/medium/3840183.jpg",
"2":"http://mw2.google.com/mw-panoramio/photos/medium/25214140.jpg"}';
var images = jQuery.parseJSON(json);
// load first image
$('img').attr('src', images[0]);
var currImg = 0;
$('.prevImg').click(function (){
if (currImg - 1 >= 0)
{
// show previous image
$('img').attr('src', images[currImg - 1]);
currImg--;
}
return false;
});
$('.nextImg').click(function (){
if (currImg + 1 < Object.keys(images).length)
{
// show previous image
$('img').attr('src', images[currImg + 1]);
currImg++;
}
return false;
});
I'm trying to create a news viewer with Xcode 4. This should look like the following:
===============================
Title comes here ------- Date
Image
News Body
================================
As you can see, the news body must be pushed downward depending on the size of the image. The image must be pushed downward as the height of the title varies. I know I have to do some programming to position them dynamically. The only problem is I'm not familiar with CGRect and Frame things...
Where can I find a tutorial or sample code I can take a look and get some ideas? Practical codes or tutorials would be appreciated as just reading documentation doesn't really give me a clear idea how to approach this.
UILabel provides -sizeWithFont:constrainedToSize:lineBreakMode: which will allow you to determine the size needed to fit the text you wish to display. I put together an example of resizing UILabels when I first ran into a similar problem and posted it here: http://blog.carbonfive.com/2009/07/10/resizing-uilabel-to-fit-text/
I'm afraid that's rather old now but I think should still be of some use.
I am trying to take a chart(on it's own "sheet", not as an object inside of another "sheet"), and display it on a VB2010 windows form.
The only thing I could find was creating the chart using code, and then loading in the data series from excel. ie. Chart1.ChartType = "XYscatter" or something along those lines, and I haven't even gotten that to work right.
I have way to many charts to go through and manually set them to the way they should be. Is there an easy way to just use Imports Microsoft.Office.Interop to do something along the lines of
Chart1 = xlWorkBook.Charts("MyChart")
?
Your are on the right line, if you have specific questions about creating a chart with code, post what you've got and i'll see if i can help
If you want to display the chart on a .Net form it might be best to take an image of the chart and put that on the form
get a chart object:
Set Chart1 = xlWorkBook.Charts("MyChart")
copy it
Chart1.ChartArea.Copy
its now on the clipboard. you should be able to access from there in .Net as you see fit
To prove its there, you can paste it into a normal excel worksheet
ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)", _
Link:=False, DisplayAsIcon:=False
I have a jqGrid that's working 100% except that it keeps displaying "undefined" in the "Loading..." overlay. I can't really figure it out. It seems like I should only get the "undefined" message if something isn't set right and the grid would cease to work. But that's not the case. scratches head
I'm not really sure a code sample would help here, but if anyone would like to see a certain part of my code let me know and I'll included.
Has anyone else come across this issue before? I'm probably missing something so simple and small that I can't see it. So my apologies in advance if this is a no-brainer
Thanks for your help.
That text comes from $.jgrid.defaults.loadtext. So either:
You have an old grid.locale-en.js which doesn't specify it, or
You overwrite it somewhere.
In addition, I've found that the <script> tag that defines grid.locale-whatever must appear before the <script> tag that loads jqgrid.
Doesn't make sense to me.