Generate pdf from HTML in div using Javascript

I have the following html code:

<!DOCTYPE html>
        <p>don't print this to pdf</p>
        <div id="pdf">
            <p><font size="3" color="red">print this to pdf</font></p>

All I want to do is to print to pdf whatever is found in the div with an id of “pdf”. This must be done using JavaScript. The “pdf” document should then be automatically downloaded with a filename of “foobar.pdf”

I’ve been using jspdf to do this, but the only function it has is “text” which accepts only string values. I want to submit HTML to jspdf, not text.

291 thoughts on “Generate pdf from HTML in div using Javascript”

  1. Hey I know this is off topic but I was wondering if you knew of
    any widgets I could add to my blog that automatically tweet my newest
    twitter updates. I’ve been looking for a plug-in like this
    for quite some time and was hoping maybe you would have some experience with something like
    this. Please let me know if you run into anything. I truly enjoy reading
    your blog and I look forward to your new updates.

  2. Pingback: My Homepage
  3. It is perfect time to make some plans for the future and it is time to be happy.

    I’ve learn this publish and if I may just I desire to counsel you some fascinating
    things or advice. Maybe you can write next articles regarding
    this article. I wish to read more things approximately it!

  4. Hello terrific website! Does running a blog such as this require
    a large amount of work? I’ve no knowledge of coding
    but I had been hoping to start my own blog in the near
    future. Anyhow, if you have any recommendations or techniques for new blog owners
    please share. I understand this is off subject but I simply had to ask.
    Thank you!

  5. First off I would like to say great blog! I had a quick question that I’d like to ask if you
    don’t mind. I was curious to know how you center yourself and clear your mind before writing.
    I have had a tough time clearing my thoughts in getting my thoughts out there.
    I do take pleasure in writing but it just seems
    like the first 10 to 15 minutes are generally wasted simply just trying to figure out how to begin. Any suggestions
    or tips? Many thanks!

  6. Hey! I know this is somewhat off topic but I was wondering which blog
    platform are you using for this site? I’m getting sick and tired of WordPress because I’ve had issues with hackers
    and I’m looking at options for another platform.
    I would be great if you could point me in the direction of a
    good platform.

  7. Hi there, I read your new sthff daily. Your story-telling style iss witty,
    keep doing what you’re doing!
    Katzenleine testsieger site welches ist das beste
    katzenstreu test

  8. I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more
    often. Did you hire out a designer to create your theme?
    Fantastic work!

  9. You’re so awesome! I do not believe I’ve truly read a single thing like that before.
    So great to find someone with a few genuine thoughts on this issue.
    Seriously.. thanks for starting this up. This site is one thing that iis
    needed on the web, someone with a bit off originality!


  10. each time i used to read smaller content that as well clear their motive, and that is also haplpening with this
    paragraph which I am reading at this place.

    On Aprikl 7, the pink supermoon, typically knlwn as
    a Paschal full moon, stuffed the night sky with a bright and luminous tribute to the spring season,
    shining above some off probably the most famous landmarks in the
    United States including the Empire State Buildng and the Washington Monument.
    He is being held in a brfand new York prison after being convicted of
    similar costs earlier this yr. Likewise there’s various
    portable clubhouse with itss exclusive programming as properly.

  11. Greetings from Colorado! I’m bored at work soo I decided to browse your blog on my iphone during lunch break.
    I enjoy the info you present here and can’t wait to take a
    look when I get home. I’m surprised aat hhow faet your blog loaded on my mogile ..

    I’m nnot even using WIFI, just 3G .. Anyhow,
    fantasxtic site!

    Yang mana melayani berbagai perjudian on-line terbaik juga memberikan banyak
    promo yang menarik. Building a website has ever been a strong scheme to
    advertise business. It’s handy forr them to play as a result of they’ll do so during the evening or day, and they can so from whwrever they are, aas longg
    as they’ve a cellphone or laptop computer.

  12. Attractive component to content. I simply stumbled upon your web site and in accession capital to claim that I acquire actually loved account your weblog posts.
    Any way I will be subscribing in your feeds or even I
    fulfillment you get admission to constantly rapidly.

  13. Wow, wonderful weblog format! How llong have you
    been running a blog for? you made blogging glance easy. The entire glance of your site is fantastic, as
    well ass the content material!


  14. Wonderful blog! I found it while searching on Yahoo News.
    Do you have any suggestions on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!

  15. Oh mmy goodness! Impressive article dude! Thank yoou so
    much, However I am going through problems with your RSS.
    I don’t know why I can’t join it. Is there anyone elee getting the same RSS issues?
    Anyone who knows the answer can you kindly respond? Thanx!!

    Bulldog frances marron site bulldog frances sevilla

  16. I don’t know if it’s just me or if everyone else encountering problems with your blog.
    It appears like some of the written text on your posts are running off
    the screen. Can someone else please comment and let me know if this is happening to them as well?
    This might be a problem with my browser because I’ve had this happen previously.

    Feel free to surf to my homepage:

  17. It’s a pity you don’t have a donate button! I’d most certainly
    donate to this superb blog! I guess for now i’ll
    settle for book-marking and adding your RSS feed to
    my Google account. I look forward to new updates and will share this blog with my Facebook group.
    Talk soon!

  18. betflik เว็บไซต์รวมสล็อตและการพนันสล็อตแนวใหม่ บริการผ่านเทคโนโลยี ฝากเงิน – ถอนเครดิต auto betflik เกมเกมสล็อตและเกมส์คาสิโนออนไลน์ค่ายยอดนิยมจัดให้ในที่ทางเข้าเดียวการันตีชื่อแบรนด์สมัคร betflik co ทางเข้าเล่นสล็อตแตกง่าย เกมส์ยิงปลาออนไลน์ นอกนั้นยังมีเกมคาสิโนออนไลน์รวมกว่า 2466 เกมโดยแบรนด์ผู้พัฒนาเกมส์คาสิโนยอดนิยมเยอะกว่า 30 แบรนด์ชั้นนำทั่วโลก
    betflik thailand เวปสล็อตมือถือทุกแบรนด์ เล่นได้ทั้งสล็อต เกมยิงปลา
    และการพนันสไตล์อื่นๆกว่า 10 แบรนด์ดัง เดิมพันสล็อตบนเว็บไซต์ได้ทั้ง Joker123 PG Pocket
    Games PragmaticPlay สล็อตBPG PSslot
    SPslot EP Slot NetEnt Entertainment สล็อตKalamba Gamatron Toptrend Slots MG Slot สล็อต FA Chai Funky Game Slot
    QS RedTiger Habanero Kingmaker เว็ป BETFLIK แจ็คพอตแตกประจำแล้วยังแทงพนันเกมส์ไพ่ทั้งได้เงินและสนุกได้อีกเยอะกว่า 27 แบรนด์สุดฮิต เดิมพันได้ทั้งเกมส์ยิงปลา บาคาร่า เสือมังกรออนไลน์ เกมลูกเต๋า Roulette.
    Betflik.coมีเกมส์กาสิโนต่างๆเข้าเดิมพันได้ทั้ง Sexy Gaming SA casino Dream Gaming WMคาสิโน BIG Gaming AG Gaming
    GDG Gaming Heng เกมมิ่ง AMBpoker เรานำเกมทั้งหมดมารวมไว้เว้ปเดียว betflik thailand
    บริการผ่านระบบ ฝากเงิน – ถอนเงินออโต้ที่เร็วทันใจ ระบบสมาชิกใช้งานง่ายเล่นสล็อตออนไลน์โดยคอมพิวเตอร์หรือโทรศัพท์มือถือของผู้เล่นได้ทั้งระบบ Ios และ Android

  19. Thank you, I’ve recently been looking for info about this
    topic for ages and yours is the best I have came upon so far.

    However, what concerning the bottom line? Are you
    certain in regards to the source?


  20. Hello! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My weblog looks weird when viewing from my
    iphone4. I’m trying to find a theme or plugin that might
    be able to fix this problem. If you have any suggestions, please share.

  21. Have you ever considered about including a little bit more than just your
    articles? I mean, what you say is valuable and everything.
    But just imagine if you added some great images or videos to
    give your posts more, “pop”! Your content is excellent but with pics and videos, this site could definitely be one of the greatest
    in its niche. Awesome blog!

  22. Write more; that’s all I have to say. It seems as though you relied
    on the video to make your point. You know what you’re talking about, why waste
    your intelligence on just posting videos to your blog
    when you could be giving us something enlightening to read?

  23. Do you have a spam problem on this site; I also
    am a blogger, and I was wanting to know your situation; we have created some nice practices and we
    are looking to swap solutions with others, why not shoot me an e-mail if interested.

  24. Excellent goods from you, man. I’ve understand
    your stuff previous to and you’re just too
    magnificent. I really like what you have acquired here, certainly
    like what you’re saying and the way in which
    you say it. You make it entertaining and you still care for to keep it
    wise. I cant wait to read much more from you. This is actually a terrific website.

  25. Woah! I’m really digging the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s hard to get that “perfect balance”
    between superb usability and visual appeal. I must say you’ve done a very good job with this.
    Additionally, the blog loads extremely quick for me on Safari.
    Exceptional Blog!

  26. Write more; that’s all I have to say. It seems as
    though you relied on the video to make your point. You know what you’re talking about, why waste your
    intelligence on just posting videos to your blog when you could be giving us something enlightening to read?

  27. Does your blog havfe a contact page? I’m having problems locating it but,
    I’d like tto shoot you an email. I’ve got sopme recommendatioons forr your blog you might
    be interested in hearing. Either way, great blog and I lolk
    forward to seeing it improve over time.
    Bonuys bez depozytu kasyno web page internetowe gry hazardowe

  28. However, users must improve to a paid “gold” membership so as to view folks’s details or send them a message.
    A message middle helps users contact each other without being forced to provide out their private email addresses.
    The pc isn’t dependent on a router being close by either.

    Additionally, whereas I remember being excited as I discovered all of the computerlike things I may do
    on my telephone, the tablet’s bigger form seems mostly irksome, as a result of it reminds me
    of all of the stuff I wish to do with it, however cannot.
    Since these providers only depend on having a reliable telephone, internet connection and
    net browser, companies have seemed increasingly at hiring dwelling-primarily
    based staff. Keep your password to your self,
    no matter what, and you never have to fret about it.
    Even sharing the password with a friend so he or she can log
    on and check something for you is usually a danger.

  29. The site also options a feed of Hasselhoff’s tweets, so customers are at all times privy to what their idol is as much as.

    It is a bit like betting pink or black on roulette, and the percentages of you being profitable are 1:
    1. So, it is as much as you whether or not you want to danger your payline win for a 50% likelihood you may
    increase it. So, there you might have it – you will not be
    able to plug in a Rumble Pak, Controller Pak or perhaps a Transfer Pak.
    Another feature of the N64 controller is the flexibility to
    add choices by way of an growth slot on the bottom of
    the controller. One distinctive characteristic of the game of Thrones slot is the choice gamers must gamble
    every win for the possibility to double it. Most hair dryers (together with this one) have excessive and
    low airflow settings. Though high school is usually painful, having
    your present canceled doesn’t must be. 0.01 per slot line and
    ending with high limits – $one hundred per spin or even greater.

    Although Game of Thrones slot doesn’t have a jackpot, the sport
    is stuffed with particular symbols and bonus options that provides
    to the fun. The iconic Game of Thrones emblem appears within the type of the slots wild symbol while the notorious Iron Throne
    is the scatter image wanted to set off the game’s unique bonus options.

  30. I try to remain physically active and in good shape, being mindful of my dietary choices, and to give myself the rest I need.
    In short, I try to avoid being hungry, angry, lonely, and tired, as these four things can trigger an emotional spiral.
    You might want to try some of my tricks.

    It might help you too just like me.

  31. Hello there! This is my first comment here, so I just wanted to give a quick shout out and say I genuinely enjoy reading your articles.
    Can you recommend any other blogs/websites/forums that deal with the same subjects?

  32. Then you possibly can take the motherboard back out,
    place the spacers, and put the motherboard in on top of them.
    While an appointment might need a particular time restrict, that
    does not necessarily imply the business can accommodate two appointments again to back.
    But changing one or two parts, especially the oldest part or the one
    you’ve got decided is causing a bottleneck, can provide spectacular efficiency enhancements while remaining cost effective.
    It has been a while since I cracked a pc open and explored its innards, but this endeavor has inspired me to, on the very least, upgrade the RAM in my laptop computer.
    Case, Loyd. “Find out how to Upgrade Your Graphics Card.” Pc World.
    Or would you like to make use of a graphics card on the motherboard to maintain the price and measurement down?
    A nice midrange card can enormously enhance performance for
    a few hundred dollars, but you may as well find much cheaper ones that are not bleeding-edge that will fit your needs
    simply high-quality.

  33. Some kits come full with a mounting bracket that allows you to fasten your portable
    CD player securely inside your automobile. If your portable CD player has
    an AC enter, you can plug one finish of the adapter into
    your portable player and the opposite finish into your car’s cigarette lighter and you’ve got a energy provide.
    Taking it one step further, set an affordable
    decorating timeframe — say seven days, for instance. Tablets are exceedingly standard as of late, and some
    command premium prices. The superstar of idea USA’s tablets is the CT920, which has a 9.7-inch (1024
    by 768) show. For the same price, you’ll be able to
    seize the T1003, which boasts a 10-inch resistive display with
    a decision of 1024 by 600. It comes with 4GB of flash reminiscence,
    which may be expanded to 16GB by the microSD slot and 512MB RAM.
    For effectively underneath $200, you’ll be able to have a
    model like this one with a 10-inch show. Also price noting — this one
    has a USB host adapter, so you’ll be able to connect a full-size keyboard or mouse
    for easier enter.