summary refs log tree commit diff
path: root/pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch
diff options
context:
space:
mode:
authorWouter den Breejen <uu@denbreejen.net>2007-11-20 17:27:24 +0000
committerWouter den Breejen <uu@denbreejen.net>2007-11-20 17:27:24 +0000
commit040966d95d6e00e03cca32de76120b1192f11d45 (patch)
treec8fa78ba4aed7958ecf69b8a82baf0ef915ad352 /pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch
parent42ee316fcc5440bc2999437340e614609834fbfe (diff)
downloadnixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.tar
nixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.tar.gz
nixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.tar.bz2
nixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.tar.lz
nixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.tar.xz
nixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.tar.zst
nixpkgs-040966d95d6e00e03cca32de76120b1192f11d45.zip
This is a quote from http://www.johannes-bauer.com/xpdf/xpdf.php, any moral issues can be posted on the mailing list ;) "If you are the proud owner of a proprietary PDF-Creator like "Adobe Acrobat" you probably have noticed that it gives you the option to make the resulting PDF protected in a way that you cannot copy any text from it or that you cannot extract the pictures within. What a nice little feature. Now what this technically does is to set a flag in the PDF telling the reader program "Please don't let the mean user copy any content from me! ". However, the whole process relies on the reader progam (like "Adobe Acrobat Reader" or "xpdf", in our case) to obey the request of the PDF creator. Now at this point, xpdf really pissed me off. Because it really does obey the completely non-sensical request of the PDF creator. Probably because of some legal trouble which Adobe might give them if they did not obey it. But logically there is absolutely no reason to restrict the extraction of text of graphical images from a PDF file. Text I could read and type it in again. Pictures I could photograph off my PC screen. It's completely moronic. It's Adobe. Plus some people at my college think it's protecting their documents well. They seem to believe that content which is made for education should under no circumstances leak to the outside - somebody could maybe learn something! It would be a disaster! It is obvious they're morons. This patch just proves my point."
svn path=/nixpkgs/trunk/; revision=9765
Diffstat (limited to 'pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch')
-rw-r--r--pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch b/pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch
new file mode 100644
index 00000000000..598fc6dbd07
--- /dev/null
+++ b/pkgs/applications/misc/xpdf/xpdf-3.02-protection.patch
@@ -0,0 +1,74 @@
+diff -C 3 -r orig/xpdf/pdfimages.cc xpdf-3.02/xpdf/pdfimages.cc
+*** orig/xpdf/pdfimages.cc	2007-02-27 23:05:52.000000000 +0100
+--- xpdf-3.02/xpdf/pdfimages.cc	2007-10-31 20:17:22.601449943 +0100
+***************
+*** 118,130 ****
+      goto err1;
+    }
+  
+-   // check for copy permission
+-   if (!doc->okToCopy()) {
+-     error(-1, "Copying of images from this document is not allowed.");
+-     exitCode = 3;
+-     goto err1;
+-   }
+- 
+    // get page range
+    if (firstPage < 1)
+      firstPage = 1;
+--- 118,123 ----
+diff -C 3 -r orig/xpdf/pdftotext.cc xpdf-3.02/xpdf/pdftotext.cc
+*** orig/xpdf/pdftotext.cc	2007-02-27 23:05:52.000000000 +0100
+--- xpdf-3.02/xpdf/pdftotext.cc	2007-10-31 20:17:34.392224196 +0100
+***************
+*** 160,172 ****
+      goto err2;
+    }
+  
+-   // check for copy permission
+-   if (!doc->okToCopy()) {
+-     error(-1, "Copying of text from this document is not allowed.");
+-     exitCode = 3;
+-     goto err2;
+-   }
+- 
+    // construct text file name
+    if (argc == 3) {
+      textFileName = new GString(argv[2]);
+--- 160,165 ----
+diff -C 3 -r orig/xpdf/XPDFCore.cc xpdf-3.02/xpdf/XPDFCore.cc
+*** orig/xpdf/XPDFCore.cc	2007-02-27 23:05:52.000000000 +0100
+--- xpdf-3.02/xpdf/XPDFCore.cc	2007-10-31 20:18:05.370494431 +0100
+***************
+*** 384,394 ****
+  #ifndef NO_TEXT_SELECT
+        if (selectULX != selectLRX &&
+  	  selectULY != selectLRY) {
+! 	if (doc->okToCopy()) {
+! 	  copySelection();
+! 	} else {
+! 	  error(-1, "Copying of text from this document is not allowed.");
+! 	}
+        }
+  #endif
+      }
+--- 384,390 ----
+  #ifndef NO_TEXT_SELECT
+        if (selectULX != selectLRX &&
+  	  selectULY != selectLRY) {
+! 	copySelection();
+        }
+  #endif
+      }
+***************
+*** 407,415 ****
+    int pg;
+    double ulx, uly, lrx, lry;
+  
+-   if (!doc->okToCopy()) {
+-     return;
+-   }
+    if (getSelection(&pg, &ulx, &uly, &lrx, &lry)) {
+      //~ for multithreading: need a mutex here
+      if (currentSelection) {
+--- 403,408 ----