Fandom

Scratchpad

Hack to capture a snapshot of an annotated image in Crocodoc

216,093pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Presently, Crocodoc does not allow downloading a PDF of an annotated document if the underlying document is an image. But you can grab a snapshot of the annotated image with a browser plugin and a little hackery.

  • I used Firefox 6.0 to view my annotated image and Fireshot 0.92 to capture a snapshot of the page.
  • By default, the HTML elements that display the annotated image have a limited height, so if the image is larger than you can display on screen (as mine was), Fireshot will only be able to capture the visible portion.
  • You can inject some CSS to force the height of these elements to be larger (3000px was enough for my case).
  • Create the XML file given below, and import it as a rewrite rule for Charles Proxy Server.
  • Load your annotated image with Crocodoc in your browser. Charles will rewrite a line of the page from Crocodoc with some extra CSS. You may wish to hide the list of contributors and resize the width for an optimal snapshot.
  • Capture the entire page with Fireshot and view the resulting file. It should be a 3000px-high image.
  • If not, sorry - this hack might need updating, or something else might have gone wrong. Your mileage may vary.

CrocodocSnapshotHack.xml

<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0-ea" class="java.beans.XMLDecoder">
 <array class="com.xk72.charles.tools.rewrite.RewriteSet" length="1">
  <void index="0">
   <object class="com.xk72.charles.tools.rewrite.RewriteSet">
    <void property="active">
     <boolean>true</boolean>
    </void>
    <void property="hosts">
     <void property="locationPatterns">
      <void method="add">
       <object class="com.xk72.charles.lib.DefaultLocationMatch">
        <void property="location">
         <object class="com.xk72.net.Location">
          <void property="host">
           <string>crocodoc.com</string>
          </void>
         </object>
        </void>
       </object>
      </void>
     </void>
    </void>
    <void property="name">
     <string>Crocodoc Snapshot Hack</string>
    </void>
    <void property="rules">
     <void method="add">
      <object class="com.xk72.charles.tools.rewrite.RewriteRule">
       <void property="active">
        <boolean>true</boolean>
       </void>
       <void property="matchHeader">
        <string></string>
       </void>
       <void property="matchResponse">
        <boolean>true</boolean>
       </void>
       <void property="matchValue">
        <string><!--Whitelabel Stuff--></string>
       </void>
       <void property="newHeader">
        <string></string>
       </void>
       <void property="newValue">
        <string><style type="text/css">html,body,.wrap,.main,.container,#PageSplitter,#LeftPane,#DocHolder{height:3000px !important}</style></string>
       </void>
       <void property="replaceType">
        <int>1</int>
       </void>
       <void property="ruleType">
        <int>7</int>
       </void>
      </object>
     </void>
    </void>
   </object>
  </void>
 </array>
</java>

Also on Fandom

Random wikia