Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Anybody use WeasyPrint for HTML to PDF?

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #163160
    nixnerd
    Participant

    If you’re not familiar, it basically uses Python to convert HTML/CSS to PDF. I found this because I’m writing an app that automatically tracks all my billable hours by client and spits out the info to an HTML/CSS template. However… clients want a nice, easy to digest PDF emailed to them. So, I had to figure out a way to EASILY and AUTOMATICALLY convert HTML to PDF through a nice script that I can use over and over again. I posted the question on Reddit and got this:

    http://weasyprint.org/

    I haven’t used it yet but it looks AWESOME! Just thought I would share it with those who don’t know about it.

    #163167
    __
    Participant

    Looks nice. Timely, too.

    #163169
    nixnerd
    Participant

    I cannot wait to use this. I need to write the rest of my app though. That’s like the last stage.

    Would you recommend installing this with pip in a virtualenv or using a package on the AUR? If there isn’t one, I’d have to build it… not that appealing. Because then I have to maintain it.

    See, I Installed SASS and Compass with Ruby Gems… the way most people do. However, there’s also AUR packages for both of those. Some people say I should use the built-in package management tools for each language. Some people say I should use Pacman and just let my OS keep everything up to date.

    If it were you… how would you manage all of this? I ask because you know about all three of these things… Arch, Python, SASS, etc. Although, you use Bourbon. But, I presume it’s the same deal.

    #163170
    nixnerd
    Participant

    It’s effing easy to just type Pacman -Syu and have Arch do it all. But… maybe that’s not the best way. Especially if you’re running multiple version of Python, Ruby, etc.

    I run Python 3 by default in Arch but I write in Python 2.x. Does that make a difference?

    #163178
    __
    Participant

    Would you recommend installing this with pip in a virtualenv or using a package on the AUR?

    I’d probably use a package, if it’s available. I think it’d be up to you. A package might be easier to use from the terminal (i.e., not inside the python repl).

    If there isn’t one, I’d have to build it… not that appealing. Because then I have to maintain it.

    Not really. You can build it and just throw it out there with a “anyone want to maintain this?” note. Happens all the time.

    I run Python 3 by default in Arch but I write in Python 2.x. Does that make a difference?

    From what I understand, 2 and 3 have a lot of common ground. It depends on what/how you wrote the v2 code, however. If you have the choice, I’d say move to v3 asap. It’s “the future of the language“. Also:

    A non-exhaustive list of features which are only available in 3.x releases and won’t be backported to the 2.x series:

    *strings are Unicode by default *clean Unicode/bytes separation *exception chaining *function annotations *syntax for keyword-only arguments *extended tuple unpacking *non-local variable declarations

    I started out with v3, and I have no experience (yet) migrating versions.

    #163179
    nixnerd
    Participant

    What?! You learned on Python 3? How? I haven’t even found any materials on Python 3. I was SHOCKED that Arch implemented it as default Python version since it doesn’t have very wide adoption.

    Learn Python the Hard Way and Codecademy are both Python 2.x. I guess you could’ve read the docs on Python 3 but I am the kind of guy that needs exercises.

    Also, I was under the impression that Python 3 wasn’t backwards compatible at all.

    About the package: I’m a little confused. The Python community tells me to install it in a virtualenv. In fact, they say that is the preferred way to install all Python extensions/packages. Same with the Ruby crowd. If I go to an Arch Linux board, they say to use a package. Funny thing is, I tried installing the SASS and Compass packages via the AUR first. I went about it the usual way with makepkg… didn’t work at all. I guess I’m doing something wrong. But… for whatever reason, they don’t work like all the other packages.

    Plus, I’ve never built an Arch package and it sounds kind of tedious. However, I want to do things the best way. I’m looking for the least amount of breakage with updates.

    #163271
    __
    Participant

    You learned on Python 3?

    right here. I like reference manuals.

    As for exercises, I watched the course on Pluralsight and it was pretty good. (I had a free trial.)

    As for backwards-compatibility, my impression is that the language (versions) themselves have a lot in common, but that doesn’t necessarily mean that the code people write does. Like I said, I’ve never tried porting code back and forth, so I really have no idea.

    Package: I wasn’t suggesting you build one (I don’t know how to go about that either), but if you wanted to, I don’t think you’d need to worry about maintaining it.

    Overall… sorry. I don’t really know the answers. My last comments were just best guesses.

    #163281
    nixnerd
    Participant

    It’s all good. I don’t think anyone knows the answer.

    Ha ha ha. I knew it. You just read the docs. I don’t really like the way Python’s docs are written. The Arch Wiki has me spoiled.

    Maybe I’ll give them another go.

    #163285
    __
    Participant

    I knew it. You just read the docs.

    I do. I like docs. But I know that’s not a “typical” way to learn for most people.

    There’s also a local python group that I go to once in a while, which is always fun and informative.

    #163288
    nixnerd
    Participant

    Sweet! I want to go to one in my city. We have a pretty good Linux users group I wang to go to.

    #163292
    __
    Participant

    We have a pretty good Linux users group I wang to go to.

    TMI : )

    #163297
    nixnerd
    Participant

    HA HA HA HA HA HA!!! Sorry, that was from my phone. I hate my iPhone more and more each day.

    It’s time for a nice, big, unlocked and rooted HTC One Developer Edition.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘Other’ is closed to new topics and replies.