4 ms·
Show HN: Pystitcher – A Declarative Alternative to Pdftk
- GranPC 5y agoNeat, this looks pretty useful for a project I'm working on. What's the performance like?
- captn3m0 5y agoI've tested it against a 800 page compilation and didn't face any issues : https://github.com/captn3m0/pdp-book https://github.com/captn3m0/pdp-book. Takes ~2 seconds for a fresh build on my system right now. time pystitcher --verbose complete.md output.pdf [2021-12-31 00:00:48] INFO:pystitcher.stitcher:Deleting temporary files real 2.244 user 2.160 sys 0.063 pcpu 99.07 I've run it against entr[0] for live-recompilations, and it was pretty good. [0]: https://github.com/clibs/entr https://github.com/clibs/entr
- jimnotgym 5y agoSlight aside...today I received a pdf that was 90 degrees from being correct on screen in Adobe reader, and I clicked on the 'rotate' button to find that Adobe has made this a subscription feature!
- db65edfc7996 5y agoIf you rotate your monitor, is that circumventing the DRM?
- jimnotgym 5y agoI printed it in the end, same result. Circumventing DRM
- Tomte 5y agoPDF on Windows is… sad. I've settled on Okular, for now. Yes, the KDE tool. They have a standalone Windows installer.
- ratsmack 5y agoI left Adobe a long time ago and started using Foxit. It's not perfect, but gets the job done for considerably less money.
- xtiansimon 5y agoOn Windows I run Adobe XI, mostly because I don’t like the look of Acrobat DC. And I guess bonus, you can rotate—sheesh!
- thunderbong 5y agoUse SumatraPDF https://www.sumatrapdfreader.org/free-pdf-reader https://www.sumatrapdfreader.org/free-pdf-reader
- apollo1213 5y agoTry online pdf tool https://docmadeeasy.com/ https://docmadeeasy.com/
- johntb86 5y agoI'm used to seeing markup languages (ab)used as configuration languages, but this is the first time I've seen markdown used that way. Though the input has a lot of links, so it makes sense in a way.
- captn3m0 5y agoOne of the future goals is to abuse this further to allow you to write inline markdown so you can add section or title pages easily.
- JasonFruit 5y agoI haven't used Pdftk for some of the things detailed in the article, so I don't know: other than being declarative, what's better about this than Pdftk? I've always been able to use Pdftk for my needs, and it satisfies picky publishers' tools that barfed on other ways of achieving my goals.
- captn3m0 5y agoFor complicated tasks (say merging two PDFs, one of which needs to be upscaled and rotated) - it will take a dew attempts. And if this ends up being a repetitive task, you can commit the markdown file to code, which explains the intent much better than pdftk’s command line arguments.
- throwaway984393 5y ago"using a declarative input in the form of a markdown file" You mean a markdown formatted config file. All config files are declarative; an imperative config file would be bizarre.
- captn3m0 5y agoI need to rephrase this, but I mean declarative like Terraform here - you specify the end state, and don’t worry about how to get there. It’s close to a Makefile in intent that way (which I wouldn’t call a config file). Other tools end up with confusing CLI args as a hacky config.
- throwaway984393 5y agoIf you unwrap the covers a bit more behind the terminology it becomes a little more clear when to use what terms (and what they imply). Terraform and Make implement declarative domain-specific programming languages. They have their own data types and primitives, including a syntax, grammar, operators, functions, etc in order to create a new interpreted program in a higher order language. Your tool seems to use Markdown as a format to set variables for your program to use in creating a document, and then an ordered data set which is converted into new object types and rendered as a pdf, in combination with the previously set variables. You can separate the variables as command-line options or include them with the data set, but either way they're not creating a new program, they're using your program's existing logic. Plus, your file format doesn't have the properties of a language. So this would be called a configuration file (or 'input file' since it's sort of data + configuration) rather than a programming language or configuration language. Not a huge distinction from the user's perspective, but it actually is important in terms of your program's design. For example, if you did want to implement a language, you don't want to implement it as some other format, like YAML (a data serialization format) or Markdown (a document markup format). Languages work best with their own parser/lexer/format and thus avoid all the inherited pitfalls and limitations of a different file format. 'Declarative' is used mainly in terms of languages because it's distinct from 'imperative' where you execute one statement at a time. If you don't have a language, you could still have imperative/declarative if your program either executes one task at a time, or has advanced logic that tries to predict what might happen and changes its operation accordingly. And you can actually do both in the same program, making the whole thing more confusing! I do like your idea of embedding options/variables in your dataset! It's a slick way to allow more reproducible results and a simpler user experience.
- deleted 5y ago[deleted]