How to compare two PDF documents
eclecticlight.co
eclecticlight.co
apt install diffpdf
pacman -S diffpdf
https://gitlab.com/eang/diffpdfThings like legal documents should be restricted to plain text... and stuff like line endings should be standardized for this purpose.
I don't see that happening! ;)
Also, Markdown won't nearly represent all the formatting possibilities of a PDF.
Also, I'm not sure HTML is much easier to compare than PDF. Both are markup languages, essentially.
But following along your idea, it would be nice if the document itself contained separate content and presentation layers, so that we could manipulate and analyze (and compare) the content.
Reading a book on a screen, I find PDF far superior to HTML or Word or text.
I don't know about you but sometimes a smartphone is the only display I have available - and reading pdf's on a phone is undeniably terrible.
Should HTML+CSS really be able to do everything PDF does? And is it commonly implemented that well, at least by well-resourced sites?
> reading pdf's on a phone is undeniably terrible
I actually find it to be fine, but I am thinking of book pages, so maybe 8 x 6 inches. What I miss are efficient tools such as markup, bookmarking, etc.
What do you like about it for reading? It seems worse than HTML or MOBI for lots of reasons.
I haven't tried Mobi though and would like to. Any suggestions would be appreciated: I am reading books, often scanned. I need efficient markup tools (bookmarks, highlighting, annotation) using a separate editable markup layer (so I can edit my markup and easily strip the markup), the ability to copy blocks of text (for notes), and preservation of content and my markup across Mobi applications and decades into the future (e.g., like PDF/A). And complete end-user control - the book is mine, stored on my systems.
in CHI EA '16: Proceedings of the 2016 CHI Conference Extended Abstracts on Human Factors in Computing SystemsMay 2016 Pages 621–631https://doi.org/10.1145/2851581.2892588
https://www.cs.cmu.edu/~jbigham/pubs/pdfs/2016/pdf-accessibi...
The hardest parts would probably be scoping to figure out what Adobe extensions to support, and acquiring or reverse engineering the Adobe extension formats.
Simple PDF example:
%PDF-1.3
%‚„œ”
1 0 obj
<<
/Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R
>>
endobj
2 0 obj
<<
/Type /Outlines
/Count 0
>>
endobj
3 0 obj
<<
/Type /Pages
/Count 2
/Kids [ 4 0 R 6 0 R ]
>>
endobj
4 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources <<
/Font <<
/F1 9 0 R
>>
/ProcSet 8 0 R
>>
/MediaBox [0 0 612.0000 792.0000]
/Contents 5 0 R
>>
endobj
5 0 obj
<< /Length 1074 >>
stream
2 J
BT
0 0 0 rg
/F1 0027 Tf
57.3750 722.2800 Td
( A Simple PDF File ) Tj
ET
BT
/F1 0010 Tf
69.2500 688.6080 Td
( This is a small demonstration .pdf file - ) Tj
ET
BT
/F1 0010 Tf
69.2500 664.7040 Td
( just for use in the Virtual Mechanics tutorials. More
text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 652.7520 Td
( text. And more text. And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 628.8480 Td
( And more text. And more text. And more text. And more
text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 616.8960 Td
( text. And more text. Boring, zzzzz. And more text. And
more text. And ) Tj
ET
BT
/F1 0010 Tf
69.2500 604.9440 Td
( more text. And more text. And more text. And more text.
And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 592.9920 Td
( And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 569.0880 Td
( And more text. And more text. And more text. And more
text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 557.1360 Td
( text. And more text. And more text. Even more. Continued
on page 2 ...) Tj
ET
endstream
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources <<
/Font <<
/F1 9 0 R
>>
/ProcSet 8 0 R
>>
/MediaBox [0 0 612.0000 792.0000]
/Contents 7 0 R
>>
endobj
7 0 obj
<< /Length 676 >>
stream
2 J
BT
0 0 0 rg
/F1 0027 Tf
57.3750 722.2800 Td
( Simple PDF File 2 ) Tj
ET
BT
/F1 0010 Tf
69.2500 688.6080 Td
( ...continued from page 1. Yet more text. And more text.
And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 676.6560 Td
( And more text. And more text. And more text. And more
text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 664.7040 Td
( text. Oh, how boring typing this stuff. But not as boring as watching ) Tj
ET
BT
/F1 0010 Tf
69.2500 652.7520 Td
( paint dry. And more text. And more text. And more text.
And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 640.8000 Td
( Boring. More, a little more text. The end, and just as
well. ) Tj
ET
endstream
endobj
8 0 obj
[/PDF /Text]
endobj
9 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
>>
endobj
10 0 obj
<<
/Creator (Rave \(http://www.nevrona.com/rave\))
/Producer (Nevrona Designs)
/CreationDate (D:20060301072826)
>>
endobj
xref
0 11
0000000000 65535 f
0000000019 00000 n
0000000093 00000 n
0000000147 00000 n
0000000222 00000 n
0000000390 00000 n
0000001522 00000 n
0000001690 00000 n
0000002423 00000 n
0000002456 00000 n
0000002574 00000 n
trailer
<<
/Size 11
/Root 1 0 R
/Info 10 0 R
>>
startxref
2714
%%EOF #! /bin/bash
pdf_one="$1"
pdf_two="$2"
text_one=$(mktemp)
text_two=$(mktemp)
pdftotext "$pdf_one" "$text_one"
pdftotext "$pdf_two" "$text_two"
diff "$text_one" "$text_two"Links for those who are similarly curious, with the 2nd link being especially fascinating:
https://unix.stackexchange.com/questions/276751/is-space-all...
https://web.archive.org/web/20170215070707/http://www.in-ulm... (courtesy of one of the answers in the first link but separately interesting IMHO)
I will say, I don't know if it's Stockholm Syndrome from years of writing them with the space or what, but I do find the space version nicer to read, doubly so when using the [almost obligatory on macOS] `/usr/bin/env bash` form since it makes all the participants in the shebang space delimited.
I can easily see the counterargument from those misguided souls who hard-code `/bin/bash` that the non space version is their muscle memory and requires less mental parsing