Friday, October 21, 2011

Trying to fix corrupt Adobe PDF files

The company I work for uses an online document management system and like to work with large PDF files (I recently worked with a 353 page, 17 MB problem PDF). Too often, we have PDF files have problems or have pages get corrupt. I haven't found a cause or a solution that always fixes the problems, but here are some methods I have found that work (my reference is Adobe Acrobat 8 Pro).

Use Preflight to check the PDF for syntax issues (requires Acrobat Pro or above - and I haven't found out what to do with this information):
Click Advanced -> Preflight... in Adobe Acrobat Pro
Expand PDF Analysis, select Report PDF syntax issues, and click Execute.

Remove the Tags in the document (requires Acrobat Pro or above) :
Right-click the Navigation Pane and click Tags
Click the root of the Tags tree
Right-click Tags and click Delete Tag
Save

Reduce File Size (Acrobat Standard or above):
Click Document -> Reduce File Size...
(you can adjust the Compatibility level of the file)
Click OK
Save as a new file name and click Save

Use the PDF Optimizer to remove features (one by one or all then all minus 1, then all minus 2, etc) (Adobe Acrobat Pro or above):
Click Advanced -> PDF Optimizer...
Click the checkbox next to unnecessary settings or settings you would like to try to remove for troubleshooting purposes
Click OK
Save as a new file name and click Save

Try resaving the document using Nitro PDF Reader (this has worked for me many times):
Open the document in Nitro PDF Reader
Click File -> Save As -> PDF Document
Save the file using a different name and click Save

Delete bad pages (either one by one or as a group, if necessary) (Adobe Acrobat Standard or above):
Open the problem PDF in Adobe Acrobat
Click the tool "Click to show one page at a time"
Page through the pages in the PDF, note any page that gives you an error message.
In the Navigation Pane, click Pages. Select the problem pages, right-click, and click Delete Pages...
Click File -> Save As, save the file using a different name, and click Save

Export as PostScript without comments, export comments, convert PostScript to PDF, and import comments (you lose bookmarks using this method) (Adobe Acrobat Standard or above):
Click Comments -> Export Comments to Data File..., give it a name, and click Save
Click File -> Export -> PostScript -> PostScript
Click Settings and uncheck Include Comments, click OK, give it a different name, and click Save.
Open the PS file in Adobe Acrobat.
Click Comments -> Import Comments..., select Adobe FDF File from the file types drop-down, click the FDF file, and click Select.
Click File->Save.

Monday, October 3, 2011

Search, search, work, then find site with exact solution

I frequently come across a frustrating scenario where I search, read, work, and struggle through how to do something and then find a site with the steps clearly laid out to do the thing I just struggled to figure out how to do. I find this happens most frequently to me in working to solve a problem with Microsoft software then finding an official Microsoft site with the solution. This is not a criticism against Microsoft but a comment on the availability of documentation (both at Microsoft's site and on the internet in general).

I found a site with instructions on loading sound drivers (https://www.dan.me.uk/blog/2010/09/26/freebsd-sound-card-driver/), installing a GUI (https://www.dan.me.uk/blog/2010/09/26/gnome-gui-freebsd-8/), and installing the Flash plugin (https://www.dan.me.uk/blog/2010/09/26/installing-flash-plugin-10-for-firefox-in-freebsd-8/) in FreeBSD at https://www.dan.me.uk/blog/ that could have saved me some work. Unfortunately, it's been a while since he's posted to his blog. I found my instructions from the FreeBSD Handbook (http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/), which, of course, got me to the same result.

Saturday, October 1, 2011

FreeBSD 8.2 i386 X11, XFCE4, sound, Firefox3, and Flash on Samsung NC20

Last time I tried it, I was unable to get Flash Player working on FreeBSD 7.2. I was able to get it working on FreeBSD 8.2 on my Samsung NC20 using the ports system. I didn't try ports last time, but it wasn't as hard as I thought. First I installed X11 (xorg-7.5) and Xfce4. Then I installed Firefox 3.6 from packages and loaded sound.

I installed xorg-7.5 from packages from the FreeBSD 8.2 RELEASE i386 DVD:
mount -t cd9660 /dev/cd0 /cdrom
pkg_add /cdrom/packages/All/xorg-7.5.tbz

To configure xorg, I added hald_enabled="YES" and dbus_enabled="YES" to /etc/rc.conf. I restarted and ran Xorg -configure then edited xorg.conf.new to include my screen resolution (Modes 1280x800). To test, I ran X -config /root/xorg.conf.new -retro. Since this worked, I switched to tty1, back to tty0, pressed CTRL+C then copied /root/xorg.conf.new to /etc/X11/xorg.conf (cp xorg.conf.new /etc/X11/xorg.conf).

I couldn't find Xfce4 on the DVD, so I had to get it from the internet. I went with Xfce because I don't like KDE4 or Gnome 3 (I liked Gnome 2 and KDE 3). I might want to try LXDE instead of Xfce.
pkg_add -r xfce4

I restarted and ran startxfce4. I got the latest Firefox I could get from packages:

pkg_add -r firefox

I enabled sound in /boot/loader.conf by adding the line snd_hda_load="YES" then I got the flash plugin from ports (some steps may be out of order):

portsnap fetch
portsnap extract
(if I had ran portsnap extract before, I would have run portsnap update)
cd /usr/ports/www/nspluginwrapper
make
(then I added linux_enable="YES" to /boot/loader.conf, saved, and restarted)
cd /usr/ports/www/nspluginwrapper
make install
make clean
cd /usr/ports/www/linux-f10-flashplugin10
make
make install
make clean
mkdir /usr/local/lib/browser_plugins/
ln -s /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so /usr/local/lib/browser_plugins/
ln -sv /usr/local/lib/browser_plugins/npwrapper.libflashplayer.so /usr/local/lib/firefox3/plugins/npwrapper.libflashplayer.so
nspluginwrapper -v -a -i
(nspluginwrapper -v -a -i needs to be run by each user, according to the FreeBSD Handbook)