npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

djvused2pdfmark

v0.0.3

Published

Convert djvu bookmarks (outline) or meta to pdfmark code

Downloads

23

Readme

djvused2pdfmark

npm i -g djvused2pdfmark

When converting a djvu file to a pdf, it's often desirable to transfer the outline & metadata to the pdf as well.

PDF supports a special pdfmark operator that is used for features like bookmarks & docinfo. Using ghostscript, you can augment an existing pdf w/ pdfmark commands:

$ gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf input.pdf example.pdfmark

djvused2pdfmark helps you to create such example.pdfmark file.

outline

djvused(1) util exports/imports outlines in the form of sexps:

(bookmarks
 ("Preface" "#1")
 ("1 Introduction" "#2"
  ("1.1 Foo" "#3")
  ("1.2 Bar" "#4"
   ("1.2.1 start" "#5"))
  ("1.3 Baz" "#6"))
 ("2 Setup" "#7")
 )

To convert them in pdfmark commands, run:

$ djvused -e print-outline file.djvu | djvused2pdfmark
[/Page 1 /Title (Preface) /OUT pdfmark
[/Count 3 /Page 2 /Title (1 Introduction) /OUT pdfmark
[/Page 3 /Title (1.1 Foo) /OUT pdfmark
[/Count 1 /Page 4 /Title (1.2 Bar) /OUT pdfmark
[/Page 5 /Title (1.2.1 start) /OUT pdfmark
[/Page 6 /Title (1.3 Baz) /OUT pdfmark
[/Page 7 /Title (2 Setup) /OUT pdfmark

Only outlines that point to page numbers are supported for now.

meta

For some reason djvused(1) doesn't use sexps for metadata parts, but a bizarre list of pairs:

key1\t"value1"
key2\t"value2"
...

To convert them to pdf docinfo, pass 'meta' CL argument to djvused2pdfmark cmd:

$ djvused -e print-outline file.djvu | djvused2pdfmark meta
[ /Author (John Doe\, Jane Doe)
  /CreationDate (D:19980101000000)
  /Creator (Heaven knows)
  /Producer (A \(custom makefile!)
  /Title (Foo Bar)
  /Subject (An Administrator Guide to Foobar)
  /Keywords (one\, two)
  /ModDate (D:20180101000000)
  /DOCINFO pdfmark

License

MIT.