You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,19 +13,42 @@ Therefore, I developed through the powerful go programming language a new tool c
13
13
14
14
## How it works
15
15
16
-
From a technical point of view, the tool is very simple and trivial. Pdf-diff uses pdftoppm to generate a series of images from the pdfs to be compared (one for each page). It then uses a very trivial pixel comparison algorithm to draw some red rectangles that display the differences between one pdf and another. The go script also uses golang's very powerful native encoding/decoding engine (which I personally was not familiar with!). I was very impressed with what is possible to do co Go in just a few lines of code.
16
+
From a technical point of view, the tool is very simple and trivial. Pdf-diff uses pdftoppm to generate a series of images from the pdfs to be compared (one for each page). It then uses a very trivial pixel comparison algorithm to draw some red rectangles that display the differences between one pdf and another. The difference is based on RGB values of the pixel, so it can basically compare whatever you want. The go script also uses golang's very powerful native encoding/decoding image engine (which I personally was not familiar with!). I was very impressed with what is possible to do with Go in just a few lines of code.
17
+
18
+
The images generated by pdf are inserted into a folder named as the hash of the content of the pdf file. E.g. the file has the hash `fc324..`, the images are in the `fc324` folder. If a folder with that name already exists, pdf-diff will not create any images since it consider that images were already generated.
17
19
18
20
The code is not very clean and certainly can be optimized. I am asking some person much more knowledgeable than me in graphics if it is possible to create a simple algorithm that can apply a background color only locally, and not on the whole row where the pixel is changed.
19
21
20
22
## How to use
21
23
22
-
work in progress
24
+
The only requirement asked for running this tool is the `pdftoppm` program. Based on your operating system or distro, you might want to check `poppler-utils` package. A command for installing that tool in Ubuntu/Debian distro might be:
25
+
26
+
```
27
+
apt install poppler-utils
28
+
```
29
+
30
+
To run the script, you can simply open a new shell and type:
31
+
32
+
```
33
+
go run main.go ./pdf-1.pdf ./pdf-2.pdf
34
+
```
35
+
36
+
or:
37
+
38
+
```
39
+
go build
40
+
./main pdf-1.pdf pdf-2.pdf
41
+
```
42
+
43
+
Once ran, the images are created in the folder `generated`.
23
44
24
45
### Contact
25
46
26
-
If you wish to use this for your project, go ahead. If you have any issues or improvements, feel free to open a new [ISSUE]. Lastly, if you have a good algorithm to implement or just to discuss about any other tools for editor, you can [email me](hi@serhack.me)
47
+
If you wish to use this for your project, go ahead. If you have any issues or improvements, feel free to open a new [ISSUE]. Lastly, if you have a good algorithm to implement or just to discuss about any other tools for editor, you can [email me](hi@serhack.me).
27
48
28
49
#### Donation
29
50
51
+
If you think my work contributed a little bit to your projects, goals or company, please let me know.
0 commit comments