{"id":201,"date":"2010-09-01T10:37:30","date_gmt":"2010-09-01T05:07:30","guid":{"rendered":"http:\/\/www.cvr.cc\/?p=201"},"modified":"2010-09-01T10:37:30","modified_gmt":"2010-09-01T05:07:30","slug":"pdfpagediff","status":"publish","type":"post","link":"https:\/\/cvr.cc\/?p=201","title":{"rendered":"Pdfpagediff"},"content":{"rendered":"<p>We often encounter nightmarish scenario while generating final versions of a long document when one or more of the following happens:<\/p>\n<ol>\n<li> New revised versions of packages used.<\/li>\n<li> Smaller changes to a fewer number of pages of a long document. <!--more--><\/li>\n<li> No change in the document, but recompiled with revised page  numbers as it happens during compilation of journal articles into an  issue for printing.<\/li>\n<li> Simply you happened to re-typeset for no reason and then you&#8217;re  forced to check each page for surprises.<\/li>\n<\/ol>\n<p>Now you are left with the job of comparing the <small>PDF<\/small>s generated now and that of previous version and it is not fun. <code>pdgpagediff<\/code> package helps to make your job easier.<\/p>\n<h4 style=\"color: #27d;\">Principles<\/h4>\n<p>We have a version of document, say, <code>file1.pdf<\/code> and we have its revised version, <code>file2.pdf<\/code>.  <code>pdfpagediff<\/code> will create a composite <small>PDF<\/small> by juxtaposing each page of <code>file1.pdf<\/code> over the corresponding page of <code>file2.pdf<\/code> or vice-versa. Since the <small>PDF<\/small>s are transparent, you can notice the slightest change visually by simply flipping through the pages.<\/p>\n<h4 style=\"color: #27d;\">Dependencies<\/h4>\n<p><code>pdfpagediff<\/code> depends on the following packages:<\/p>\n<ol>\n<li> <code>geometry.sty<\/code><\/li>\n<li> <code>graphicx.sty<\/code><\/li>\n<li> <code>color.sty<\/code><\/li>\n<li> <code>substr.sty<\/code><\/li>\n<\/ol>\n<h4 style=\"color: #27d;\">Package loading and commands<\/h4>\n<p>Package can be loaded with the following command:<\/p>\n<pre>  \\usepackage{pdfpagediff}<\/pre>\n<p>Another command <code>\\layerPages<\/code> has been defined to include two versions of the <small>PDF<\/small> documents to create the composite document, the syntax is:<\/p>\n<pre>  \\layerPages[&lt;optional page numbers&gt;]{&lt;file1&gt;}{&lt;file2&gt;}<\/pre>\n<p>First one doesn&#8217;t have an optional argument of page numbers, which means all the pages will be used to create the composite document. Second one has comma separated page numbers and hyphen separated page ranges which can be mixed in any order as shown in subsequent examples of usage. The last one has <code>10-<\/code> which means from page <code>10<\/code> to end of the document.<\/p>\n<ol>\n<li> <code>\\layerPages{file1.pdf}{file2}<\/code><\/li>\n<li> <code>\\layerPages[1,2,4-6,8]{file1}{file2.pdf}<\/code><\/li>\n<li> <code>\\layerPages[1,2,4-6,8,10-22]{file1.pdf}{file2.pdf}<\/code><\/li>\n<li> <code>\\layerPages[1,2,4-6,8-13,17]{file1}{file2.pdf}<\/code><\/li>\n<li> <code>\\layerPages[10-]{file1.pdf}{file2.pdf}<\/code><\/li>\n<\/ol>\n<p>You need Adobe Reader to view the composite document which only provides to view each layer or all layers together or no layers at all.  There is a small layer button at top left hand side of the Adobe Reader window, see the figure below:<\/p>\n<figure id=\"attachment_226\" aria-describedby=\"caption-attachment-226\" style=\"width: 480px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/cvr.cc\/wp-content\/uploads\/2010\/09\/ar112.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-226   \" title=\"ar1\" src=\"https:\/\/cvr.cc\/wp-content\/uploads\/2010\/09\/ar112.png\" alt=\"Composite document\" width=\"480\" height=\"162\" \/><\/a><figcaption id=\"caption-attachment-226\" class=\"wp-caption-text\">Clipping from the composite document.<\/figcaption><\/figure>\n<p>You can see <code>Layers<\/code> icon, clicking on the icon will show you the layers.  We have two layers in this example, namely, <code>First<\/code> and <code>Second<\/code> which are also the default.  These labels can be changed with <code>FirstDoc<\/code> and <code>SecondDoc<\/code> commands respectively.<\/p>\n<h5 style=\"color: #27d;\">First Document<\/h5>\n<figure id=\"attachment_212\" aria-describedby=\"caption-attachment-212\" style=\"width: 480px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/cvr.cc\/wp-content\/uploads\/2010\/09\/ar22.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-212 \" title=\"ar2\" src=\"https:\/\/cvr.cc\/wp-content\/uploads\/2010\/09\/ar22.png\" alt=\"First Document\" width=\"480\" height=\"160\" \/><\/a><figcaption id=\"caption-attachment-212\" class=\"wp-caption-text\">Clipping from the first document.<\/figcaption><\/figure>\n<p>The above clipping shows the first document alone. You might note that icon for second layer is not visible now.<\/p>\n<h5 style=\"color: #27d;\">Second Document<\/h5>\n<figure id=\"attachment_213\" aria-describedby=\"caption-attachment-213\" style=\"width: 480px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/cvr.cc\/wp-content\/uploads\/2010\/09\/ar32.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-213 \" title=\"ar3\" src=\"https:\/\/cvr.cc\/wp-content\/uploads\/2010\/09\/ar32.png\" alt=\"Second Document\" width=\"480\" height=\"165\" \/><\/a><figcaption id=\"caption-attachment-213\" class=\"wp-caption-text\">Clipping from second document.<\/figcaption><\/figure>\n<p>The second document is generated with 30% gray instead of black to facilitate easy indication of locations with differences. Also, note that icon for first layer is invisible since the second layer alone is made visible here.<\/p>\n<p>You might take a look at <a href=\"#attachment_226\">composite document<\/a> which has a paragraph from the composite document. The last word of the paragraph has a mismatch. Now let us take a look at the last two lines of the above para from the <a href=\"#attachment_212\">first document<\/a> and the same location of the <a href=\"#attachment_213\">second document<\/a>. The difference is a space added before the last word \u2018concepts\u2019. If you look at the composite document now, you will get to know the difference quickly.<\/p>\n<p>Further differences can be observed in pages 9 and 17 of the included document <code>ltest.pdf<\/code>.<\/p>\n<h4 style=\"color: #27d;\">Limitations<\/h4>\n<p>Following limitations apply:<\/p>\n<ol>\n<li> Documents with enormous changes cannot be compared.<\/li>\n<li> Documents with opaque backgrounds cannot be compared.<\/li>\n<li> Tables and figures with background will not provide any  meaningful information even if there are differences.<\/li>\n<li> This is not a character by character or word by word diff  program, instead it depends largely on your eyes very much.<\/li>\n<li> <code>\\pdfpagediff<\/code> will work only with <small>PDF<\/small>T<span style=\"position: relative; top: 0.5ex; margin-left: -0.1667em; margin-right: -0.125em; text-transform: uppercase;\">e<\/span>X and will not work with  any other T<span style=\"position: relative; top: 0.5ex; margin-left: -0.1667em; margin-right: -0.125em; text-transform: uppercase;\">e<\/span>X compilers.<\/li>\n<\/ol>\n<h4 style=\"color: #27d;\">Acknowledgments<\/h4>\n<p>The test document is a chapter namely, <em>Matrix manipulation<\/em>, taken from a freely available textbook, <em>Matrix Overview<\/em> by <a href=\"http:\/\/www.plymouth.ac.uk\/staff\/phewson\">Paul Hewson<\/a>, at: <a href=\"http:\/\/knowledgeforge.net\/opentextbook\/svn\/multivariatestatistics\/\">http:\/\/knowledgeforge.net\/opentextbook\/svn\/multivariatestatistics\/<\/a>. Permission to use this chapter to demonstrate the features of <code>pdfpagediff<\/code> is gratefully acknowledged.<\/p>\n<h4 style=\"color: #27d;\">Download<\/h4>\n<p>The package can be downloaded from <a href=\"http:\/\/download.river-valley.com\/cvr\/pdfpagediff-1.2.tar.gz\">http:\/\/download.river-valley.com\/cvr\/pdfpagediff-1.2.tar.gz<\/a>. Bug reports, feature requests and suggestions can be posted here in the comment box.  The author can be contacted at <a href=\"mailto:cvr@river-valley.org\">&lt;cvr@river-valley.org&gt;<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We often encounter nightmarish scenario while generating final versions of a long document when one or more of the following happens: New revised versions of packages used. Smaller changes to a fewer number of pages of a long document.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,15],"tags":[],"class_list":["post-201","post","type-post","status-publish","format-standard","hentry","category-pagediff","category-tex"],"_links":{"self":[{"href":"https:\/\/cvr.cc\/index.php?rest_route=\/wp\/v2\/posts\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cvr.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cvr.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cvr.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cvr.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=201"}],"version-history":[{"count":0,"href":"https:\/\/cvr.cc\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions"}],"wp:attachment":[{"href":"https:\/\/cvr.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cvr.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cvr.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}