<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Karl Heinz Kremer&#039;s Ramblings &#187; Acrobat</title>
	<atom:link href="http://www.khk.net/wordpress/tag/acrobat/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.khk.net/wordpress</link>
	<description>Stuff, stuff and more stuff</description>
	<lastBuildDate>Mon, 07 Jun 2010 13:25:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Is Your Acrobat Plug-in Still Using ADM?</title>
		<link>http://www.khk.net/wordpress/2010/04/23/is-your-acrobat-plug-in-still-using-adm/</link>
		<comments>http://www.khk.net/wordpress/2010/04/23/is-your-acrobat-plug-in-still-using-adm/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 16:33:08 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[adm]]></category>
		<category><![CDATA[adobe pdf]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[wxwidgets]]></category>

		<guid isPermaLink="false">http://www.khk.net/wordpress/?p=617</guid>
		<description><![CDATA[
			
				
			
		
For a few years now Adobe has been telling 3rd party developers that the ADM (Adobe Dialog Manager) will be discontinued, and that existing plug-ins may have to be ported to something else. If I remember correctly, this started with Acrobat 7 or 8, but back then it was a soft threat &#8211; everything still [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2010%2F04%2F23%2Fis-your-acrobat-plug-in-still-using-adm%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2010%2F04%2F23%2Fis-your-acrobat-plug-in-still-using-adm%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>For a few years now Adobe has been telling 3rd party developers that the ADM (Adobe Dialog Manager) will be discontinued, and that existing plug-ins may have to be ported to something else. If I remember correctly, this started with Acrobat 7 or 8, but back then it was a soft threat &#8211; everything still worked, and there wasn&#8217;t much incentive to start porting plug-ins. However, with the release of the <a href="http://www.adobe.com/devnet/acrobat">Acrobat 9 SDK</a> the ADM related header files were gone, but ADM based plug-ins were still working (at least some of them). </p>
<p>The removal of the header files does send a strong signal, but what was an even stronger signal for me was that one of the ADM based plug-in I was working on was no longer working correctly on some versions of Windows. </p>
<p>As far as Adobe is concerned, ADM is no longer supported &#8211; that means there won&#8217;t be any bug fixes for it, but the plug-in has to work with Acrobat 9 on any Windows system that&#8217;s supported by Acrobat 9. So, what is a developer to do in such a situation?</p>
<p>Adobe does not give us much guidance in what to chose as a replacement for ADM. The most obvious choice is to stick with the native UI framework that comes with the operating system, but the advantage of ADM was that one could write UI code that would run in both Windows and Mac plug-ins. One of the sample plug-ins &#8211; wxPlugin &#8211; that comes with the Acrobat SDK is based on <a href="http://wxwidgets.org/">wxWidgets</a>. To me that was a pretty strong hint that wxWidgets would be a good choice&#8230;</p>
<p>However, even though the Mac version of the SDK does come with the wxPlugin code and even contains a XCode project file, it does not compile. After some work, trying to come up with a combination of wxWidget configuration options and wxPlugin project settings, I was able to create an Acrobat plug-in that worked. </p>
<p>In order to &#8220;fix&#8221; the Mac&#8217;s version of the wxPlugin I first had to compile wxWidgets. Use the following configure command line to create the static wxWidget libraries that can be linked with the project:</p>
<p><pre><code>configure CC=gcc-4.0 CXX=g++-4.0 LD=g++-4.0 --enable-universal_binary \
--disable-shared --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk \
--with-mmacosx-version-min=10.4 --enable-debug</code></pre></p>
<p>Just install the libraries and include files according to the <a href="http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/API_References/Acr obat_API_Reference/Samples/CodeSamples/sample-descriptions.html">instructions provided by Adobe</a>. </p>
<p>A closer inspection of the plug-in code then revealed that the part that actually did anything was commented out for the Mac with <code>#ifndef MAC_PLATFORM</code> statements, so I removed those and the last thing to do was to remove the reference to the <code>libexpat</code> library &#8211; it is provided by the operating system and does not have to be provided by wxWidgets.</p>
<p>With a working environment on the Mac, wxWidgets is a viable alternative for ADM for either new Acrobat plug-ins, or existing plug-ins that need to be modified to make them compatible with the current version of Acrobat. </p>
<p>If your Acrobat plug-ins are still using ADM, now would be a good time to think about what to do about that&#8230; If you need any help, <a href="mailto:khk+b1GvaE@khk.net">let me know</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2010/04/23/is-your-acrobat-plug-in-still-using-adm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing Acrobat JavaScript on a MacBook</title>
		<link>http://www.khk.net/wordpress/2010/03/23/javascript-console/</link>
		<comments>http://www.khk.net/wordpress/2010/03/23/javascript-console/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 17:58:20 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[adobe pdf]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.khk.net/wordpress/?p=624</guid>
		<description><![CDATA[
			
				
			
		
Acrobat&#8217;s JavaScript is a great tool to extend the application, or to automate reoccurring tasks. There are several ways a JavaScript can be added to the application or a document (e.g. folder level scripts, validation scripts, event handling scripts, &#8230;), but regardless of how a script is written, chances are that the developer wants to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2010%2F03%2F23%2Fjavascript-console%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2010%2F03%2F23%2Fjavascript-console%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Acrobat&#8217;s JavaScript is a great tool to extend the application, or to automate reoccurring tasks. There are several ways a JavaScript can be added to the application or a document (e.g. folder level scripts, validation scripts, event handling scripts, &#8230;), but regardless of how a script is written, chances are that the developer wants to test parts of the script in Acrobat&#8217;s Javascript console. This console window can be shown by either using the &#8220;Advanced>Document Processing>JavaScript Debugger&#8230;&#8221; menu item or Ctrl-J on Windows or Cmd-J on a Mac:</p>
<div style="text-align:center;"><img src="http://www.khk.net/wordpress/wp-content/uploads/2010/03/BlogPicsJS_Menu.png" alt="JS_Menu.png" border="0" width="400" /></div>
<p>After the console or debugger window comes up, the user can then enter Javascript and execute it&#8230; </p>
<div style="text-align:center;"><img src="http://www.khk.net/wordpress/wp-content/uploads/2010/03/BlogPicsJS_Debugger.png" alt="JS_Debugger.png" border="0" width="500" /></div>
<p>&#8230; that is, as long as a full keyboard with a numeric keypad is used. In Adobe&#8217;s documentation, we find the following <a href="http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_Dev_Tools.72.4.html">instructions to execute Javascript typed into the console window</a>:</p>
<p>
The JavaScript console allows you to evaluate single or multiple lines of code. There are three ways to evaluate JavaScript code while using the interactive console:</p>
<ul>
<li>To evaluate a portion of a line of code, highlight the portion and press either the Enter key on the numeric keypad or press Ctrl + Enter.</li>
<li>To evaluate a single line of code, make sure the cursor is positioned on that line and press either the Enter key on the numeric keypad or press Ctrl + Enter.</li>
<li>To evaluate multiple lines of code, highlight those lines and press either the Enter key on the numeric keypad or press Ctrl + Enter.</li>
</ul>
<p>That works fine as long as you have access to the numeric keypad, but on a MacBook or a MacBook Pro without that keypad. No key combination involving fn, ctrl, cmd or option with the Return or Enter key will result in the Javascript getting executed. </p>
<p>The virtual keyboard to the rescue: Mac OS comes with a handy keyboard viewer that allows us to send the correct key code to the application. To bring up the keyboard viewer, bring up the Mac OS System Preferences first and select the &#8220;Keyboard&#8221; category:</p>
<div style="text-align:center;"><img src="http://www.khk.net/wordpress/wp-content/uploads/2010/03/BlogPicsKeyboardViewer_1.png" alt="KeyboardViewer_1.png" border="0" width="500" /></div>
<p>Make sure that the option &#8220;Show Keyboard &#038; Character Viewer in menu bar&#8221; is selected. Once this is done, you can access the keyboard viewer from the menu bar:</p>
<div style="text-align:center;"><img src="http://www.khk.net/wordpress/wp-content/uploads/2010/03/BlogPicsKeyboardViewer_2.png" alt="KeyboardViewer_2.png" border="0" width="244" height="118" /></div>
<p>Now comes the tricky part: Write some Javascript in the console window and place the cursor on the line you want to execute or select the snippet of the Javascript that should be executed. In the following example I&#8217;m using code from <a href="http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.151.html">Adobe&#8217;s Javascript API documentation</a>:</p>
<p><pre><pre>
&nbsp;&nbsp;var menuItems = app.listMenuItems()
&nbsp;&nbsp;for( var i in menuItems)
&nbsp;&nbsp;&nbsp;&nbsp;console.println(menuItems[i] + &quot;\n&quot;)
</pre></pre></p>
<p>With the console prepped, bring up the keyboard viewer and start pushing keys &#8211; real keys that is: Hold down the &#8220;fn&#8221; and the &#8220;control&#8221; key, then move the mouse pointer to the &#8220;Enter&#8221; key on the keyboard viewer and click it&#8230;</p>
<div style="text-align:center;"><img src="http://www.khk.net/wordpress/wp-content/uploads/2010/03/BlogPicsJS_Debugger_6.png" alt="JS_Debugger_6.png" border="0" width="500" /></div>
<p>&#8230; and voila, the script gets executed:</p>
<div style="text-align:center;"><img src="http://www.khk.net/wordpress/wp-content/uploads/2010/03/BlogPicsJS_Debugger_7.png" alt="JS_Debugger_7.png" border="0" width="500"/></div>
<p>This is not the most straight forward method, but at least it&#8217;s possible to use the Javascript console to execute code when using a MacBook. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2010/03/23/javascript-console/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nuance PDF Reader</title>
		<link>http://www.khk.net/wordpress/2010/02/23/nuance-pdf-reader/</link>
		<comments>http://www.khk.net/wordpress/2010/02/23/nuance-pdf-reader/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 16:19:24 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[adobe pdf]]></category>
		<category><![CDATA[adobe reader]]></category>
		<category><![CDATA[nuance]]></category>
		<category><![CDATA[nuance pdf reader]]></category>

		<guid isPermaLink="false">http://www.khk.net/wordpress/?p=612</guid>
		<description><![CDATA[
			
				
			
		
Nuance (the people behind OmniPage and Dragon Naturally Speaking and a bunch of other things) release a competitor to the free Adobe Reader &#8211; the free Nuance PDF Reader (http://www.nuance.com/imaging/products/pdf-reader.asp). The feature list looks very promising:

Fill and save PDF forms
Annotate PDFs
Convert PDF files to Word Excel or RTF
Can disable JavaScript
100% compatibility with Adobe Acrobat (we [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2010%2F02%2F23%2Fnuance-pdf-reader%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2010%2F02%2F23%2Fnuance-pdf-reader%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Nuance (the people behind OmniPage and Dragon Naturally Speaking and a bunch of other things) release a competitor to the free Adobe Reader &#8211; the free Nuance PDF Reader (http://www.nuance.com/imaging/products/pdf-reader.asp). The feature list looks very promising:</p>
<ul>
<li>Fill <em>and</em> save PDF forms</li>
<li>Annotate PDFs</li>
<li>Convert PDF files to Word Excel or RTF</li>
<li>Can disable JavaScript</li>
<li>100% compatibility with Adobe Acrobat (we have to wait to see how compatible it really is)</li>
<li>Supports PDF Portfolios</li>
</ul>
<p>Now to the things that it does not do: </p>
<ul>
<li>No support for Mac OS X or Linux</li>
<li>No participation in online document reviews</li>
</ul>
<p>I&#8217;ve not spent enough time with it yet to offer a detailed review, but it&#8217;s certainly a good alternative to the Adobe Reader. Competition is a good thing, maybe Adobe will take a few cues from Nuance for their next release of Reader. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2010/02/23/nuance-pdf-reader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AnyBizSoftware PDF To PowerPoint Converter &#8211; Free Today &#8211; Expired!</title>
		<link>http://www.khk.net/wordpress/2009/10/19/anybizsoftware-pdf-to-powerpoint-converter-free-today/</link>
		<comments>http://www.khk.net/wordpress/2009/10/19/anybizsoftware-pdf-to-powerpoint-converter-free-today/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 17:01:06 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[PDF]]></category>
		<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Conversion]]></category>
		<category><![CDATA[powerpoint]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=601</guid>
		<description><![CDATA[
			
				
			
		
Converting PDF documents to PowerPoint presentations is probably not something you need every day. I think I needed it once when the original PowerPoint file of a presentation I needed to give was no longer available, but the PDF file created from that presentation was. I did not have access to AnyBizSoft PDF to PowerPoint [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F10%2F19%2Fanybizsoftware-pdf-to-powerpoint-converter-free-today%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F10%2F19%2Fanybizsoftware-pdf-to-powerpoint-converter-free-today%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Converting PDF documents to PowerPoint presentations is probably not something you need every day. I think I needed it once when the original PowerPoint file of a presentation I needed to give was no longer available, but the PDF file created from that presentation was. I did not have access to <a href="http://www.anypdftools.com/pdf-to-powerpoint.html">AnyBizSoft PDF to PowerPoint Converter</a> back then, so a lot of copy&amp;pasting took place.</p>
<p>Today you can download a free version of that software from <a href="http://www.giveawayoftheday.com/">GiveAwayOfTheDay.com</a>. I&#8217;ve played around with the application a little, and it really does what it promises: PDF elements get converted to editable PowerPoint page elements.</p>
<p>Here is a list of the key features of AnyBizSoft <a href="http://www.anypdftools.com/pdf-to-powerpoint.html">PDF to PowerPoint Converter</a>:</p>
<ol>
<li>Convert PDF files to PPT presentations quickly and accurately</li>
<li>Retain all the layouts, images, and hyperlinks in the output documents</li>
<li>Produce an editable and dynamic PPT presentation with a few clicks</li>
<li>Convert up to 200 PDF files at the same time</li>
<li>Support Office 2010 and Windows 7</li>
</ol>
<p>I cannot vouch for the last two list items, but I know that it worked for up to seven files, and that all the other claims are true. If you think you&#8217;ll ever need to convert a PDF file to PowerPoint, give AnyBizSoft PDF Converter a try &#8211; and if you do it (download and activate) today from <a href="http://www.giveawayoftheday.com/">GiveAwayOfTheDay.com</a> it will not even cost you a dime.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/10/19/anybizsoftware-pdf-to-powerpoint-converter-free-today/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Acrobat/PDF Tip: Converting a Document to PDF</title>
		<link>http://www.khk.net/wordpress/2009/06/09/acrobat-pdf-converting-document-google-docs/</link>
		<comments>http://www.khk.net/wordpress/2009/06/09/acrobat-pdf-converting-document-google-docs/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 01:02:53 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[PDF]]></category>
		<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[google apps]]></category>
		<category><![CDATA[google docs]]></category>
		<category><![CDATA[powerpoint]]></category>
		<category><![CDATA[primopdf]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=550</guid>
		<description><![CDATA[
			
				
			
		
Have you ever needed a PDF version of a document, but you either did not have the correct source application (e.g. MS Word, PowerPoint, &#8230;), or you didn&#8217;t have access to a PDF converter (even though the free PrimoPDF is just a mouse click away). Or, did somebody email you a PowerPoint presentation, but you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F06%2F09%2Facrobat-pdf-converting-document-google-docs%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F06%2F09%2Facrobat-pdf-converting-document-google-docs%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Have you ever needed a PDF version of a document, but you either did not have the correct source application (e.g. MS Word, PowerPoint, &#8230;), or you didn&#8217;t have access to a PDF converter (even though the <a href="http://khk.net/wordpress/2009/03/03/the-best-free-pdf-creator/">free PrimoPDF</a> is just a mouse click away). Or, did somebody email you a PowerPoint presentation, but you don&#8217;t have access to PowerPoint? But you do have access to a PDF viewer (either the free Adobe Reader, or Preview.app on the Mac). How would you convert a Word, Excel or PowerPoint document to PDF?</p>
<p><a href="http://docs.google.com">Google Docs to the rescue</a>! Did you know that Google Docs can import a number of standard file formats into it&#8217;s word processor, spread sheet and presentation applications? Once you have imported your document, you just select to print&#8230; That&#8217;s it. Oh, I probably should explain that Google converts your document to PDF for printing purposes and then downloads that PDF to your computer. So just open that PDF file, and there is your document, now converted to a portable, easy to open file. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/06/09/acrobat-pdf-converting-document-google-docs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>More Interactive Dynamic Stamps in Seven Easy Steps</title>
		<link>http://www.khk.net/wordpress/2009/05/31/more-interactive-dynamic-stamps-in-seven-easy-steps/</link>
		<comments>http://www.khk.net/wordpress/2009/05/31/more-interactive-dynamic-stamps-in-seven-easy-steps/#comments</comments>
		<pubDate>Sun, 31 May 2009 23:47:23 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[dynamic stamp]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=466</guid>
		<description><![CDATA[
			
				
			
		
A while ago I tried to create an interactive dynamic stamp in Acrobat. These are dynamic stamps (like for example a stamp that automatically puts the current date into a field that is part of the stamp), but with a UI component that pops up and queries the user for some information that also gets [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F05%2F31%2Fmore-interactive-dynamic-stamps-in-seven-easy-steps%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F05%2F31%2Fmore-interactive-dynamic-stamps-in-seven-easy-steps%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>A while ago I tried to create an interactive dynamic stamp in Acrobat. These are dynamic stamps (like for example a stamp that automatically puts the current date into a field that is part of the stamp), but with a UI component that pops up and queries the user for some information that also gets embedded as part of the stamp (e.g. a phone number or a name).</p>
<p>I was not very successful. I could not figure out how to make sure that the UI only gets triggered when the stamp gets applied, and not when the stamp file gets loaded by Acrobat.</p>
<p><span id="more-466"></span></p>
<p>Then I came across an article by Rick Borstein titled &#8220;<a href="http://blogs.adobe.com/acrolaw/2009/05/add_dynamic_exhibit_stamps_in_ac.html">Add Dynamic Exhibit Stamps in Acrobat using a free stamp set</a>&#8221; on the <a href="http://blogs.adobe.com/acrolaw/">Acrobat for Legal Professionals blog</a>. It had all the parts that are required, ot even came with a couple of sample stamps. It also gave credit to the original source for that information: Acrobat JavaScript Guru <a href="http://www.acrobatusers.com/tutorials/2007/02/dynamic_stamp_secrets">Thom Parker</a></p>
<p>Thom provides all the theory behind why this works &#8211; very interesting to read if you are into that kind of stuff. It&#8217;s however not required to understand all that if you just want to use these stamps. You can just download Rick&#8217;s sample files and modify them until they fit your needs.</p>
<p>However if you want a dynamic stamp that shows more than just one line of interactively provided information, the examples do not work. They only provide one one-line input field and then put that one line on the PDF document. I wanted a stamp that could actually take several lines of user input and use that in a stamp. I had some work to do&#8230;</p>
<p>Acrobat&#8217;s JavaScript does allow to create custom user interfaces by creating a data structure and then calling executeDialog() with that data as parameter. Instead of a simple call to app.response() like in Thom&#8217;s and Rick&#8217;s examples, I needed to create a more complicated UI structure and embed that in the examples.</p>
<p>Here is the original code from the example:<br />
<pre><pre>var cAsk = &quot;Enter Exhibit Number&quot; ;
var cTitle = &quot;Exhibit Number:&nbsp;&nbsp;&quot;;
if(event.source.forReal &amp;amp;&amp;amp; (event.source.stampName == &quot;#UdzyXagRctZoS5p43TZ43C&quot;))
{
&nbsp;&nbsp;var cMsg = app.response(cAsk, cTitle);
&nbsp;&nbsp;event.value = cMsg;
&nbsp;&nbsp;event.source.source.info.exhibit = cMsg;
}</pre></pre><br />
I&#8217;ve replaced that code with the following:<br />
<pre><pre>var dialog = {
&nbsp;&nbsp;retString: &quot;&quot;,

&nbsp;&nbsp;commit:function (dialog) { // called when OK pressed
&nbsp;&nbsp;&nbsp;&nbsp;var results = dialog.store();
&nbsp;&nbsp;&nbsp;&nbsp;this.retString = results[&quot;stxt&quot;];
&nbsp;&nbsp;},

&nbsp;&nbsp;description:
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;name: &quot;Stamp Information&quot;,&nbsp;&nbsp;&nbsp;&nbsp;// Dialog box title
&nbsp;&nbsp;&nbsp;&nbsp;elements:
&nbsp;&nbsp;&nbsp;&nbsp;[
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: &quot;view&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elements:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: &quot;Enter Multi-line Information: &quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: &quot;static_text&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item_id: &quot;stxt&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: &quot;edit_text&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;multiline: true,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width: 300,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height: 80
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: &quot;ok_cancel&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ok_name: &quot;Ok&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cancel_name: &quot;Cancel&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;]
&nbsp;&nbsp;}
}; 

if(event.source.forReal &amp;amp;&amp;amp; (event.source.stampName == &quot;#UdzyXagRctZoS5p43TZ43C&quot;))
{
&nbsp;&nbsp;if (&quot;ok&quot; == app.execDialog(dialog))
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;var cMsg = dialog.retString;
&nbsp;&nbsp;&nbsp;&nbsp;event.value = cMsg;
&nbsp;&nbsp;&nbsp;&nbsp;event.source.source.info.exhibit = cMsg;
&nbsp;&nbsp;}
}</pre></pre><br />
And here are the instructions to change the first stamp in Rick&#8217;s example to the new style:</p>
<ol>
<li>Open the &#8220;Exhibit+Stamp.pdf&#8221; document in Adobe Acrobat Pro</li>
<li>Go to the second page in this document &#8211; that&#8217;s the first stamp</li>
<li>Select the TouchUp Object Tool (e.g. via Tools&gt;Advanced Editing&gt;TouchUp Object Tool)</li>
<li>Right-click on the lower part of the stamp (where the UserData1 field) and select Properties&#8230; from the menu</li>
<li>Select the Options tab and check the &#8220;Multi-line&#8221; checkbox</li>
<li>Select the Calclate tab and click on the Edit button next to the custom calculation script and replace the old script with the one from above</li>
<li>Save the script with the OK button, then close the properties dialog</li>
</ol>
<p>That&#8217;s it &#8211; just install the stamp file as described in Rick&#8217;s document. Done.</p>
<p>Of will of course be hard to see two or more lines in the relatively small stamp, so you may have to change the layout of the stamp to actually make use of the additional lines.f</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/05/31/more-interactive-dynamic-stamps-in-seven-easy-steps/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Acrobat Plug-Ins</title>
		<link>http://www.khk.net/wordpress/2009/04/14/acrobat-plug-ins/</link>
		<comments>http://www.khk.net/wordpress/2009/04/14/acrobat-plug-ins/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 00:40:12 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[acrobat plug-in]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[plug-in]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=326</guid>
		<description><![CDATA[
			
				
			
		
If you&#8217;ve seen my resume &#8211; or talked to me lately, you know that I create Acrobat plug-ins for a living. When people hear that, they usually think something like &#8220;Don&#8217;t forget to pick up the dry cleaning&#8221; or &#8220;I need to bring my cat to the vet for the rabies shot&#8221;&#8230; Yes, I understand, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F04%2F14%2Facrobat-plug-ins%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F04%2F14%2Facrobat-plug-ins%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>If you&#8217;ve seen my <a href="http://khk.net/wordpress/resume/">resume</a> &#8211; or talked to me lately, you know that I create Acrobat plug-ins for a living. When people hear that, they usually think something like &#8220;Don&#8217;t forget to pick up the dry cleaning&#8221; or &#8220;I need to bring my cat to the vet for the rabies shot&#8221;&#8230; Yes, I understand, this may not be the most exciting topic, but probably only because you don&#8217;t know enough about what these &#8220;plug-ins&#8221; are, so let me explain.</p>
<p><a title="View 'Conservatory-038' on Flickr.com" href="http://www.flickr.com/photos/68335338@N00/3440056708"></p>
<div style="text-align:center;"><img class="flickr" src="http://farm4.static.flickr.com/3584/3440056708_32cec4e199.jpg" alt="Conservatory-038" /></div>
<p></a></p>
<p><a title="View 'Conservatory-038' on Flickr.com" href="http://www.flickr.com/photos/68335338@N00/3440056708"></a></p>
<p>Â </p>
<p>Adobe Acrobat is a very powerful tool, more powerful that most users actually realize. I wont go into any details about how powerful exactly &#8211; at least not today. Lets just say that it has something for everybody. However, you may need something in addition to what Adobe provides, something that still is in the general area of PDF. Adobe may not have considered your needs because either the target market for &#8220;your&#8221; feature is too small, or to far out there&#8230; Or you are so far ahead of everybody else that they have not even thought about that feature yet.</p>
<p>Adobe did however do a very interesting thing: They created an interface that allows 3rd party developers to create solutions based on Adobe Acrobat &#8211; using plug-ins. It is a very powerful interface, and hence not something that you can pick up in an afternoon. There are several thousand pages of API documentation that one needs to understand before a plug-in should be written.</p>
<p>A plug-in is &#8211; from a technical point of view &#8211; a module or library that gets loaded dynamically at runtime. Acrobat will scan it&#8217;s plug-ins directory and will load any modules it finds. Once loaded, such a plug-in can extend Acrobat by e.g. adding menu items, toolbuttons, or event handlers (e.g. a function that gets executed whenever a documents gets loaded).</p>
<p><a title="View 'Conservatory-013' on Flickr.com" href="http://www.flickr.com/photos/68335338@N00/3439227641"></p>
<div style="text-align:center;"><img class="flickr" src="http://farm4.static.flickr.com/3577/3439227641_2f7148f1cf.jpg" alt="Conservatory-013" /></div>
<p></a></p>
<p><a title="View 'Conservatory-013' on Flickr.com" href="http://www.flickr.com/photos/68335338@N00/3439227641"></a></p>
<p>Â </p>
<p>Interestingly enough, the plug-ins directory of a fresh Adobe Acrobat installation is not empty&#8230; A lot of Acrobat&#8217;s functionality is actually implemented as plug-ins. You can verify that on a Windows system by temporarily disabling all plug-ins by holding down the Shift key when bringing up Acrobat. That will load the application without any plug-ins. When you compare the toolbar or the menu bar with a fully loaded application, you&#8217;ll see what portion of the Acrobat core functionality is actually implemented in plug-ins.</p>
<p>The plug-in interface has different abstraction levels (COS, PDE, AV, &#8230;). If there is enough interest, I will provide information about how to navigate that API, and how to structure a plug-in.</p>
<p>The Acrobat SDK is available for free from Adobe&#8217;s <a href="http://www.adobe.com/devnet/acrobat/">Acrobat Development Center</a>.</p>
<p>Here are a few examples of commercially available plug-ins that I&#8217;ve used:</p>
<ul>
<li><em>Enfocus PitStop Professional:</em><br />
This is a preflight tool.</li>
<li><em>Quite Imposing Plus:</em><br />
The best PDF based imposition tool that I am aware of.</li>
<li><em>Enfocus Browser:</em><br />
Allows to review and change the internal structure of a PDF file.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/04/14/acrobat-plug-ins/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Splitting PDF Pages</title>
		<link>http://www.khk.net/wordpress/2009/03/30/splitting-pdf-pages/</link>
		<comments>http://www.khk.net/wordpress/2009/03/30/splitting-pdf-pages/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 02:23:49 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Scanned pages]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=306</guid>
		<description><![CDATA[
			
				
			
		
No, this is not about my patent pending idea of a sheet splitter that turns  duplex documents into simplex documents&#8230; This post is about a problem that comes up every now and then: When you scan a book or a magazine, chances are that you end up with two physical pages on your scanned [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F03%2F30%2Fsplitting-pdf-pages%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F03%2F30%2Fsplitting-pdf-pages%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>No, this is not about my patent pending idea of a sheet splitter that turns  duplex documents into simplex documents&#8230; This post is about a problem that comes up every now and then: When you scan a book or a magazine, chances are that you end up with two physical pages on your scanned image, and your document looks something like this:</p>
<div style="text-align:center;"><img src="http://khk.net/wordpress/wp-content/uploads/2009/03/joinedpages.png" alt="JoinedPages.png" border="0" width="200" /></div>
<p>Pages one and two are on the same scan, three and four are, and five and six and so on. </p>
<p>How can we split such a combined page into it&#8217;s two parts? </p>
<p>There are of course different solutions to this problem, some more complicated than others, some producing better results than others. </p>
<p>The most straight forward approach would be to write an Acrobat plug-in or a standalone application (e.g. using the iText library) that takes the source page, determines what needs to be copied to the new page that should represent the left half of the original page, and then just copy those page elements. With a scanned source document, this would potentially mean that the scanned image needs to be cropped and placed on the target page. Sounds complicated, and it is complicated. Is there an easier way to accomplish the same results?</p>
<p>[More after the jump]</p>
<p><span id="more-306"></span>If we have access the Acrobat, we can use JavaScript to mimic the behavior of the just described application. With Acrobat&#8217;s JavaScript, we do of course not have access to the page content elements, so we need to find a different way to end up with the same results. </p>
<p>JavaScript gives us access to the crop box of a PDF page (if you don&#8217;t know what that is, read up on page boxes in the <a href="http://www.adobe.com/devnet/pdf/pdf_reference.html">PDF Reference</a>), this means we can find out how big a page is, but also set the crop box to configure which part of the page should be displayed in the viewer, or should get printed. </p>
<p>So, if our combined page is 11&#215;17&#8243;, and we want to extract two 8 1/2&#215;11&#8243; pages, we first need to &#8220;select&#8221; the left half of the page, and then the right half of the same page. </p>
<p>Here is the script that will do just that:<br />
<a href="http://khk.net/wordpress/wp-content/uploads/2009/03/splitpages.js" title="SplitPages.js">SplitPages.js</a></p>
<p>Copy that file to the Acrobat JavaScript directory &#8211; for Acrobat 9 on a Windows machine that would be <pre>c:\Program Files\Adobe\Acrobat 9.0\Acrobat\JavaScript</pre></p>
<p>Now let&#8217;s take a look at the different parts of the script:<br />
<pre><code>ProcessDocument = app.trustedFunction(function()
{
&nbsp;&nbsp;&nbsp;&nbsp;// create a new document
&nbsp;&nbsp;&nbsp;&nbsp;app.beginPriv();
&nbsp;&nbsp;&nbsp;&nbsp;var newDoc = app.newDoc();
&nbsp;&nbsp;&nbsp;&nbsp;app.endPriv();</code></pre><br />
This snippet shows that we are declaring a trusted function. This is necessary because we need to execute the app.newDoc() method, which requires (since Acrobat 7) a privileged context. The first thing we do in this script is to create that new document &#8211; the call is wrapped with the beginPriv() and endPriv() calls. When creating a new document in JavaScript, the document is no only created, Acrobat will also add a page to that document. We don&#8217;t need that page, but every PDF document that is getting displayed in Acrobat, needs at least one PDF page. We will deal with that extra page later. </p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;var i = 0;
&nbsp;&nbsp;&nbsp;&nbsp;while (i &amp;lt; this.numPages)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newDoc.insertPages( {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nPage: newDoc.numPages-1,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cPath: this.path,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nStart: i
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newDoc.insertPages( {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nPage: newDoc.numPages-1,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cPath: this.path,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nStart: i
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// we did this twice so that we can then split each copy of the page into a left
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// and right half. 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i++;
&nbsp;&nbsp;&nbsp;&nbsp;}</code></pre></p>
<p>In these few lines we copy every page from the source document (this.path, which is the path to the active document) to our newly created document &#8211; and we are doing that twice. This is necessary because we need to crop out the left half of the page for the first page, and the right half of the page for the second page. After this loop, we will have twice as many pages in our new document than we have in our source document. </p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;if (newDoc.numPages &amp;gt; 1)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newDoc.deletePages(0);&nbsp;&nbsp;// this gets rid of the page that was created with the newDoc call.
&nbsp;&nbsp;&nbsp;&nbsp;}</code></pre></p>
<p>Now that we have all the pages in our new document, we no longer need the blank page we got when we created the document. So, we delete it. </p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;// at this point we have a documnent with every page from the source document
&nbsp;&nbsp;&nbsp;&nbsp;// copied twice

&nbsp;&nbsp;&nbsp;&nbsp;for (i=0; i&amp;lt;newDoc.numPages; i++)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// determine the crop box of the page
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cropRect = newDoc.getPageBox(&quot;Crop&quot;, i);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var halfWidth = (cropRect[2]-cropRect[0])/2;</code></pre><br />
We loop over all pages in our new document (that is twice the number of pages in the original document). And for every page we get the crop box. We also calculate a value that we will need later: The half of the width of that page. That is the location where the page will get split. </p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cropLeft = new Array();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropLeft[0] = cropRect[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropLeft[1] = cropRect[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropLeft[2] = cropRect[0] + halfWidth;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropLeft[3] = cropRect[3];</code></pre></p>
<p>The previous few lines create a new Array. A page box is represented as an array of four values. We can now assign the partially modified values to the new page box. As you can see, three of the four values just are copies of the original crop box. Array element 2 however gets modified. It is the original X value for the lower left point of the crop box, and we add half of our page width to that number. This means, the new right edge of the modified page box is now at the halfway point between the two sides. </p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cropRight = new Array();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropRight[0] = cropRect[2] - halfWidth;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropRight[1] = cropRect[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropRight[2] = cropRect[2];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cropRight[3] = cropRect[3];</code></pre><br />
We do something similar for the new crop box for the right side of the page. </p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (i%2 == 0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp; newDoc.setPageBoxes( {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cBox: &quot;Crop&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nStart: i,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rBox: cropLeft
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp; newDoc.setPageBoxes( {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cBox: &quot;Crop&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nStart: i,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rBox: cropRight
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
}
)</code></pre></p>
<p>This is a bit tricky&#8230; Acrobat starts to count pages with page 0. The first page in the document is on the left half of our first sheet. All of a sudden, our first page is actually an even page number (0), and not like in &#8220;normal&#8221; books an odd number (1). This means that for all even numbers we need to crop the left half, and for all odd numbers we need to crop the right half. </p>
<p>We test for &#8220;evenness&#8221; by performing the modulo operation on our page number. If the result is 0, we know we have an even number, so we can use the left side crop box. If the operation returns 1, we are dealing with an odd page number, and we will use the ride side crop box. </p>
<p>The new crop box gets applied with the doc.setPageBoxes() method. </p>
<p><pre><code>// add the menu item
app.addMenuItem({
&nbsp;&nbsp;&nbsp;&nbsp; cName: &quot;splitPagesJS&quot;,&nbsp;&nbsp;&nbsp;&nbsp; // this is the internal name used for this menu item
&nbsp;&nbsp;&nbsp;&nbsp; cUser: &quot;Split Pages&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // this is the label that is used to display the menu item
&nbsp;&nbsp;&nbsp;&nbsp; cParent: &quot;Document&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// this is the parent menu. The file menu would use &quot;File&quot;
&nbsp;&nbsp;&nbsp;&nbsp; cExec: &quot;ProcessDocument()&quot;,&nbsp;&nbsp;// this is the JavaScript code to execute when this menu item is selected
&nbsp;&nbsp;&nbsp;&nbsp; cEnable: &quot;event.rc = (event.target != null);&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // when should this menu item be active?
&nbsp;&nbsp;&nbsp;&nbsp; nPos: 0
});
</code></pre></p>
<p>Almost done&#8230; We&#8217;ve implemented the functionality to split the pages, now we just need a mechanism to actually start our little program. I&#8217;ve chosen to create a menu item under the &#8220;Document&#8221; menu. That menu item is only available (not grayed out), if we have an active document. </p>
<p>Disclaimer: Of course, there is no such thing as a sheet splitter, and therefore there is no patent application. It&#8217;s a joke.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/03/30/splitting-pdf-pages/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>More PDF Tools</title>
		<link>http://www.khk.net/wordpress/2009/03/23/more-pdf-tools/</link>
		<comments>http://www.khk.net/wordpress/2009/03/23/more-pdf-tools/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 00:50:43 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[apago]]></category>
		<category><![CDATA[enfocus]]></category>
		<category><![CDATA[nitropdf]]></category>
		<category><![CDATA[pdf enhancer]]></category>
		<category><![CDATA[pdflib]]></category>
		<category><![CDATA[pitstop]]></category>
		<category><![CDATA[primopdf]]></category>
		<category><![CDATA[quite]]></category>
		<category><![CDATA[quite imposing]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=287</guid>
		<description><![CDATA[
			
				
			
		
As promised, here are some PDF related tools that I don&#8217;t use, but either have used, have played with, or just know about how good they are. These are the tools that I recommend when somebody asks me &#8220;what would you use to do XYZ?&#8221;.
PrimoPDF
The best free PDF generator. Just see my previous blog post. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F03%2F23%2Fmore-pdf-tools%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F03%2F23%2Fmore-pdf-tools%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>As promised, here are some PDF related tools that I don&#8217;t use, but either have used, have played with, or just know about how good they are. These are the tools that I recommend when somebody asks me &#8220;what would you use to do XYZ?&#8221;.</p>
<h3><a href="http://www.primopdf.com">PrimoPDF</a></h3>
<p>The best free PDF generator. Just see my <a href="http://khk.net/wordpress/2009/03/03/the-best-free-pdf-creator/">previous blog post</a>. If you need a PDF generator, download that program.</p>
<h3><a href="http://www.nitropdf.com">NitroPDF</a></h3>
<p>From the friendly people who bring you PrimoPDF. This is a package that competes with Acrobat. It can edit PDFs, create forms, fill forms, create PDFs, &#8230; And it&#8217;s cheaper than Acrobat. There is a free eval version available. Download it, play with it and see if it covers all your PDF needs. If not, there is always Acrobat. An upcoming <a href="http://customerconnect.nitropdf.com/pages/general">release will have OCR support</a> (after release 6).</p>
<h3><a href="http://www.apagoinc.com/prod_home.php?prod_id=2">PDF Enhancer</a></h3>
<p>The PDF Enhancer is a very powerful tool to &#8220;enhance&#8221; PDFs. Enhancement in this case can mean a lot of different things: Make them smaller, fix common PDF problems, embed fonts, add or modify color management information, &#8230; There are different versions available, even a server version. Apago also has a free eval version that you can download to see if it fits your needs.</p>
<h3><a href="http://www.enfocus.com/product.php?id=855">Enfocus PitStop Professional</a></h3>
<p>PitStop is a preflight tool that I used in my previous job. In addition to preflight capabilities, it also implements the Enfocus Certified PDF Workflow that allows a PDF file to contain an audit trail of all operations that were performed on it. In addition to PitStop Professional, Enfocus also offers the PitStop server, which can do anything Pitstop Professional can do in an automated fashion.</p>
<h3><a href="http://www.quite.com/imposing/index.htm">Quite Imposing Plus</a></h3>
<p>This is simply the best imposition tool for PDFs. If you need to impose a PDF, Quite Imposing Plus can do it. It is not the easiest tool to work with. One of the best features of it is that you can create sample PDF files with page numbers to figure out how exactly an imposition scheme needs to be set up. Once you&#8217;ve figured that out, you can just re-run the same process again on your real document.</p>
<h3><a href="http://www.pdflib.com/en/pdflib-gmbh/">PDFLib</a></h3>
<p>PDFLib is a great tool to programatically create PDF files. I&#8217;ve used an older version a few years ago. I&#8217;ve followed the development of the library over the years, and I still can recommend it as an alternative to <a href="http://www.lowagie.com/iText/">iText</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/03/23/more-pdf-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My PDF Toolbox (Updated)</title>
		<link>http://www.khk.net/wordpress/2009/03/17/my-pdf-toolbox/</link>
		<comments>http://www.khk.net/wordpress/2009/03/17/my-pdf-toolbox/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 13:33:36 +0000</pubDate>
		<dc:creator>khk</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[enfocus]]></category>
		<category><![CDATA[ghostscript]]></category>
		<category><![CDATA[itext]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[pdftk]]></category>
		<category><![CDATA[xpdf]]></category>

		<guid isPermaLink="false">http://khk.net/wordpress/?p=267</guid>
		<description><![CDATA[
			
				
			
		
What tools am I using to create/process/debug PDF documents? Here is  list of my top tools and why I like them.
Adobe Acrobat Pro
This of course is the mother ship, the ultimate tool for creating, processing, editing PDF documents. It&#8217;s the solution to problems you did not even know you had&#8230; Most people only use [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F03%2F17%2Fmy-pdf-toolbox%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.khk.net%2Fwordpress%2F2009%2F03%2F17%2Fmy-pdf-toolbox%2F&amp;source=khkremer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>What tools am I using to create/process/debug PDF documents? Here is  list of my top tools and why I like them.</p>
<h3><A HREF="http://www.adobe.com/products/acrobat/">Adobe Acrobat Pro</A></H3><br />
This of course is the mother ship, the ultimate tool for creating, processing, editing PDF documents. It&#8217;s the solution to problems you did not even know you had&#8230; Most people only use a small fraction of the features that Acrobat provides. It&#8217;s not cheap, but if you require any of the features that no other tool provides, it&#8217;s worth it. </p>
<p>Here are a few tasks that I use Acrobat for:<br />
<UL><br />
<LI>Create</LI><br />
If you want the best quality PDF document, how can you go wrong with the Distiller from the people who invented PDF? There are many ways to create PDF files, but for high quality press work, I would not trust any other application.<br />
<LI>Edit and Process</LI><br />
Optimize, preflight, manage colors, insert pages, extract pages, remove pages, change page boxes, create interactive forms&#8230; Do I need to say more? Pretty much anything that&#8217;s possible with a PDF document can be done with Acrobat. Sure, there are other tools that can do some of these tasks as well, but there is no other tool that covers the broad range of features available in Acrobat.<br />
<LI>Debug</LI><br />
The preflight tool allows to check for syntax errors in PDF files, traverse the internal structure of PDF documents, look at fonts, &#8230;<br />
<LI>Programming</LI><br />
I also write <a href="http://www.adobe.com/devnet/acrobat/">software for Acrobat</a>. That&#8217;s either done as a plug-in or as JavaScript, for demo purposes I occasionally also write sample VB programs that utilize Acrobat&#8217;s <a href="http://www.adobe.com/devnet/acrobat/interapplication.html">Inter-application Communication API</a>.<br />
</UL></p>
<p><H3><a href="http://www.adobe.com/products/reader/">Adobe Reader</a></H3><br />
This one is pretty straight forward: I use it to make sure that PDFs created in Adobe Acrobat work correctly when opened in a web browser or directly in Reader. Especially when dealing with forms submission or electronic comments, it is necessary to make sure that Reader behaves correctly.  </p>
<p><H3><a href="http://www.ghostscript.com/Ghostscript.html">Ghostscript</a></H3><br />
Oftentimes it is beneficial to have a non-Adobe PDF renderer. When a PDF file is not behaving correctly, I run the file through Ghostscript to see if it fails in the same way, or if I can get more detailed error messages out of that application. The error messages Acrobat provides are not very verbose, Ghostscript can give me a stack dump, and if necessary I can even run it in the debugger to figure out exactly what&#8217;s going on. </p>
<p><H3><a href="http://foolabs.com/xpdf/">XPDF</a></H3><br />
The same reasons I gave for Ghostscript also apply to XPDF. In addition to that, XPDF also comes with a bunch of tools to extract text or images from a PDF file. Sometimes that functionality comes in handy. </p>
<p><H3><a href="http://www.lowagie.com/iText/">iText</a></H3><br />
This is a very powerful PDF library for Java. In addition to being very powerful, it&#8217;s also relatively easy to use. I have not done anything serious in Java in years (a decade?), but it does not take me long to take iText and whip something up that can almost perform miracles with PDF files. There is also a .NET port available as iTextSharp. </p>
<p><H3><a href="http://www.pdfhacks.com/pdftk/">pdftk</a></H3><br />
pdftk is an application that&#8217;s based on iText. Sid Steward took the iText Java source code and run it through a compiler to create a native binary for Windows, Mac OS and Linux. Because of that, pdftk does not require Java anymore. All that&#8217;s needed is a supported operating system. </p>
<p>It is a tool to do a number of things with PDF files (concatenate files, break a multi-page file into individual page documents, flatten forms, &#8230;). Take a look at the page that lits pdftk sample command lines to learn more about what is supported. </p>
<p>There is a small problem with pdftk: It&#8217;s no longer supported, and it cannot handle PDF files that use some of the newer PDF features. Also, there are (at least) two versions that are currently getting distributed: Get the newest one from <a href="http://www.pdfhacks.com/pdftk/">http://www.pdfhacks.com/pdftk</a> and not the one from <a href="http://www.accesspdf.com/pdftk/">AccessPDF</a>. (Update: Both links now have the same version).</p>
<p><H3>Mac OS X</H3><br />
Yes, the Mac operating system does provide some PDF related tools. There is the Preview.app application to <a href="http://www.macworld.com/article/132468/2008/04/workingmac2504.html">display and manipulate PDF</a> files, and there is the &#8220;Save as PDF&#8221; feature built into the print dialog. Not only can you save &#8220;normal&#8221; PDF files with just one mouse click, you can create press standards conform PDF/X files. </p>
<p><H3><a href="http://www.enfocus.com/product.php?id=4530">Enfocus Browser</a></H3><br />
The Enfocus Browser is two things:<br />
<UL><br />
<LI>An Acrobat plug-in</LI><br />
<LI>A standalone application</LI><br />
</UL><br />
And, it&#8217;s these two things for two operating systems: Windows and Mac OS. This tool is indispensable when you are working with the structure of a PDF file. Enfocus released version three of this tool a while ago. I mentioned this tool a couple of times already on my blog:</p>
<p><A HREF="http://khk.net/wordpress/2007/05/30/my-favorite-acrobat-8-feature/"> My Favorite Acrobat 8 Feature</A></p>
<p><A HREF="http://khk.net/wordpress/2008/09/21/the-enfocus-browser-is-back/">The Enfocus Browser is Back</A></p>
<p>One of the best features of the Browser is that it allows you to actually modify the PDF structure, however, you better hold back on that until you&#8217;ve read the PDF spec a couple of times. It&#8217;s very easy to break a PDF file by making just a few changes. </p>
<p>One of the biggest advantages of the standalone version is that I can look at a PDF file that may not open in Acrobat and find out why. </p>
<p>There are a number of other applications that I don&#8217;t user personally, but that I do recommend to others because I know how good these apps are. More about that in a future post. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khk.net/wordpress/2009/03/17/my-pdf-toolbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
