HNHacker News
TopNewBestAskShowJobs

gettalong

23 karma · joined November 28, 2008

Author of the kramdown Markdown-superset converter (https://kramdown.gettalong.org) and of the HexaPDF PDF manipulation library (https://hexapdf.gettalong.org)
submissionscomments
gettalong··on What's so hard about PDF text extraction?
I don't think LetsEncrypt provides such a service. Additionally, the certificate must/should come from a CA that is included in the AATL (https://helpx.adobe.com/acrobat/kb/approved-trust-list1.html), otherwise you won't get the nice visual check mark that the signature is okay on Adobe Reader (and, let's face it, this is what most people are probably gonna be using on Windows).

Agreed on cumbersome, I have a PNG file with transparency containing my signature and use Xournal++ (https://xournalpp.github.io/) for placing it on the PDFs. That works fine but still takes more time than I want to spend. But it's faster than typing it out every time.

gettalong··on What's so hard about PDF text extraction?
The problem with digital signatures is that you need to have an appropriate certificate to do this. If the documents are only used internally, then some self-signed certificates or a company-internal certificate authority would be fine. But usually you want an official certificate.

And many certificate authorities sell such certificates but for high prices.

Typing in the name or signing with a touch screen is actually considered a valid and binding, official signature in most countries. It is the lowest form of a signature equivalent to a written signature.

gettalong··on PDF processing and analysis with open-source tools (2021)
The problem with having a PDF file as template is that it gets very hard to define how new pages should be created whenever there is too much content to fit on the existing pages. E.g. line items in an invoice template.

What you can do is to use a PDF file for all the static content that appears on each page.

gettalong··on PDF processing and analysis with open-source tools (2021)
Verifying digital signatures is quite hard. Yeah, checking whether the stored hash is valid is simple but all the other things are hard, for example, whether the additions done to a signed PDF are actually allowed or not.

Or whether the signature is correct in all the small details, e.g. used algorithm, the included information.

And then it sometimes depends on the environment. For example, sometimes a digital signature is only considered valid if all the revocation information and all the certificates are included in the PDF.

gettalong··on What's so hard about PDF text extraction?
If the PDF creation software supports tagged PDF, text extraction gets much easier because all the text and structural information is preserved. This also allows "reflowing" of contents, similar to how a HTML page reflows on smaller screens.
gettalong··on What's so hard about PDF text extraction?
This is what PDF digital signatures are for. They allow you to make sure that the PDF hasn't been tempered with. However, that is not there original intention.

From what I remember the PDF standards groups are currently investigating adding something just for temper detection.

gettalong··on How to secure a PDF file with a password before you share it
So this has, essentially, nothing to do with PDFs, as what they suggest can be done with any content.

And if downloading via DocSend is allowed, all the problems of their Option 1 come into play.

gettalong··on Ask HN: Why is the PDF format so inaccessible?
Which programming language are you using to write your LaTeX replacement? There are PDF libraries available in most languages (granted, there is wide spectrum of them with respect to how much/good they implement the PDF specification).
gettalong··on Ask HN: Why is the PDF format so inaccessible?
Thanks for mentioning SPARCLUR - I didn't know that one and will certainly have a look at it.
gettalong··on Ask HN: Why is the PDF format so inaccessible?
Just make sure that you follow the spec. Many such programs actually leave out mandatory parts of some objects, making the whole PDF invalid.
gettalong··on Ask HN: Why is the PDF format so inaccessible?
As others have already written, there is a free version of the PDF 1.7 specification available and using this you are (nearly) able to implement a PDF reader/writer. I wrote nearly because of the many malformed PDFs out there and because of some ambiguities in the spec that will have you look at certain parts of the implementation of existing libraries.

That said implementing a basic PDF reader/writer is not that complex and can easily be done in a few months. However, since you seem to also want to generate PDF pages with content, a whole lot of things have to be considered, like fonts (Type1, TrueType, CFF) and how to actually generate the content.

Adding some straightforward text using some built-in PDF font onto a PDF page is easy. But if you want to use a (subset) TrueType or OpenType font, have ligatures, contextual character substitutions, (LaTeX like) line wrapping, tagging for accessibility, ... you will open a can of worms ;-)

This is certainly also doable but gets quite complex and is the reason many PDF libraries only implement basic typographic features that are easy. You can probably count the PDF libraries supporting advanced OpenType typographic features on one hand...

However, if you are already in the process of writing a typographical software, this last part may actually already be done in your case. So if you have, as output from that software, the glyphs and their position, there is not that much complexity to implement and you could probably use a basic PDF library to do the PDF writing for you.

gettalong··on Ask HN: Saving Webpages as PDF While Preserving Formatting
I second using the screenshot tool in Firefox. PNGs can be embedded into PDFs more or less as-is, so a PDF made from a PNG is generally only just slightly larger.

Anything other than that and you will loose some formatting.

gettalong··on Ask HN: Why size of pdf output is so large in Chrome (versus Safari)?
Safari most certainly uses macOS system functions for this and the macOS graphics system is partially based on... PDF graphics. Since that is probably optimized in any and all possible ways, I'm not surprised by this.
gettalong··on NAPS2 – Scan documents to PDF and more, as simply as possible
According to the [homepage](https://www.naps2.com/doc-getting-started.html#system-requir...) it is also available for Linux.
gettalong··on A Tale of PDF Compression
No problem, thanks!
gettalong··on A Tale of PDF Compression
5MB to 60KB seems a bit extreme for a lossless compression. Would you be able to share the original and compressed documents for study?
gettalong··on Show HN: PDF API – Generate, convert, and modify PDF documents
Yes, that is quite reasonable. The simple text annotations are quite easy to work with when using a PDF library and the standard tries to be backwards compatible where sensible.

The PDF 2.0 standard removed some parts of PDF 1.7, like the proprietary XFA forms. But most things stayed in PDF 2.0 and one can expect that those annotations will also be available in future iterations of the PDF specification.

And generally, since future PDF viewers will need to be able to view older documents (think: all the (signed) documents created by governments), you can expect PDFs created today to be usable in 30 years and more.

gettalong··on Borb – A Python library to read, write, and edit PDF files
If you want to do something like this in Ruby, have a look at HexaPDF - https://hexapdf.gettalong.org/ - which provides a full-blown implementation for reading and writing PDFs and is quite mature already (n.b. I'm the author).

It is licensed AGPL+Commercial but if you just use it for yourself, this does not matter as you can use the AGPL.

gettalong··on What static web site generators would you use?
I'm a little biased (I'm the author of webgen :) but I think webgen would suit your needs. You can install it via `gem install webgen`, it runs on Ruby 1.8, 1.9 and JRuby, supports Markdown/Textile/Haml/ERB/... and is easy to use:

* Create your website:

    webgen create my_site
* Render your website:

    cd my_site; webgen
The built website uses only relative URLs, so you can preview it by just opening `my_site/out/index.html`. Adding a page is as simple as adding a file with the extension page to the my_site/src directory. The styling of the site is done via templates, the main template being my_site/src/default.template. You can select from several different styles when creating a website (see `webgen help create`).

Menus, breadcrumb trails, links to translations of the current page are all automatically generated.

You can, if you need/want to, use webgen from a Ruby script:

    require 'webgen/website'
    ws = Webgen::Website.new(ws_directory)  # ws_directory would be the my_site directory in the example above
    ws.render
For more information have a look at the webgen website.
← PreviousPage 2 of 2