Showing posts with label IrfanView. Show all posts
Showing posts with label IrfanView. Show all posts

Sunday, March 18, 2012

Troubleshooting Some Options for Converting PDF to JPG or Other Image Formats

I had a bunch of PDFs.  I wanted to glance at just the first page of each.  This post describes some steps I took to find a way of extracting those first pages and making them easily available.

I believed it was going to be a simple matter to export from PDF to JPG using either Adobe Acrobat or IrfanView.  I had used both successfully in the past for this kind of purpose.  Unfortunately, for some reason Acrobat's Advanced > Document Processing > Batch Processing option was not working for me on this particular day.  Instead, I went into IrfanView > File > Batch Conversion/Rename, set the output format to JPG, selected the folder containing the newly created PDFs, clicked "Add All," set the output directory, and clicked Start Batch. Yet here, again, unknown causes were conspiring against me. IrfanView said, "Error! Can't load [filename]" for each of the PDFs. I tried exporting to PNG instead of JPG; same result. Was I mistaken in believing that IrfanView could produce JPGs from PDFs?  It had worked in a previous post.  Why not now?

A search led to a thread that raised the question of whether the source files were corrupt. I checked several of these newly created PDFs and they did seem to open OK in Acrobat.  So corruption didn't seem to be the issue.

At first, in that previous post, I had gotten that "Can't load" error.  The solution there was to download an upgrade to Ghostscript. Maybe I had updated IrfanView since then and, in the process, had somehow broken the Ghostscript update? I'd also gotten the error, another time, when trying to use IrfanView for audio conversions, which it apparently couldn't do.  So, ah, maybe what I was trying to do was confusing IrfanView.  I tried again with just one PDF.  There didn't seem to be much that could go wrong with that.  But it still didn't work.  When I tried to open a PDF with IrfanView, it gave me a message:

"Decode error! Can't load Ghostscript or Ghostscript error. Install Ghostscript from http://sourceforge.net/projects/ghostscript or http://sourceforge.net.
I went to the former. It pointed me to another page, and that one pointed me to yet another. It looked like Ghostscript had indeed been updated within the past month or so. I downloaded and installed the update. It didn't solve the problem, though possibly a reboot would have helped.

Was there another way to export JPGs or PNGs from PDFs? I tried XnView, which Irfan claimed was somehow built on code appropriated from him. Its interface certainly was very similar in this particular task. It didn't produce any JPGs either. A post reminded me that I hadn't tried IrfanView in command-line mode. The formula I had worked out previously was like this:
i_view32 D:\Folder1\File35.pdf /c=d:\TestFolder\File35.jpg
but now that was giving me Ghostscript errors too. A search led to suggestions to try ImageMagick and iTextSharp. The latter seemed beyond me. There were also a couple of suggestions on using scripting in GhostScript. They were a bit technical for my taste at this time.

It looked like ImageMagick had been around for a long time -- there were books about it -- and I had run across a number of references to it. So I decided to start there. The copy I downloaded from CNET was corrupted, so I got another from the ImageMagick FTP site. Unzipped, the ImageMagick program folder was 146MB and contained 5,694 files. This was no little alternative to IrfanView. This was a doctoral dissertation.  I immediately cast about for a GUI front end -- I couldn't even find its executables -- and alighted on Converseen.  I downloaded it from Softpedia and installed it.  Would it convert my PDFs to JPGs? I named three PDFs to try it. All three failed with this error:
Error: Magick: Postscript delegate failed [filename]: No such file or directory @ error/pdf.c/ReadPDFImage/664
Now, what do you suppose that meant? I tried a search and got a couple of very helpful sites in Chinese. I modified the search and, lo, it looked like that was an ImageMagick error, not a Converseen error. I gathered there could be a couple of possibilities. One was that, as someone reported, this error was likely (for some unknown reason) when converting PDFs that were mostly text, as mine were, rather than mostly image. Also, there seemed to be a regular cascade of programs: Converseen was a front end for ImageMagick which used GhostScript. So I couldn't necessarily be sure which one was responsible. For that matter, I didn't even know where to put ImageMagick; I wasn't seeing a manual. Further reading suggested that resolving problems in these programs could be challenging.

I tried another search. At the top of the list: Boxoft PDF to JPG Converter. Its installation process said, "Requires Ghostscript. Do you want to get a free GPL Ghostscript?" It seemed I was destined to have a computer full of copies of Ghostscript.  Or maybe this installation would be the answer to all of the problems described above.  I downloaded and installed the proffered Ghostscript 8.71.  The process didn't look familiar.  I wasn't sure what I had been doing with Ghostscript previously, but this wasn't it.  So would this perchance fix IrfanView?  I opened IrfanView and, wow, now it ran, no reboot necessary.  The way to fix IrfanView was to install Boxoft (or, possibly, to reinstall IrfanView).

But something was wrong.  Didn't IrfanView normally give me multiple pages, one PDF per page, when I used it to convert PDFs to JPGs?  This time, I was getting only one JPG per PDF, no matter how many pages it had.  I assumed that later Ghostscript installations replaced earlier ones, but now I saw that was not necessarily so.  I went into Control Panel > Programs and Features.  I saw three different Ghostscript items.  I wasn't sure if I could uninstall two of them without screwing up the third one.  I tried it, keeping only the Ghostscript 8.71 that I had just installed.  Boxoft and IrfanView both ran as before.  So cleanup accomplished, but IrfanView problem not fixed.

Since I now had Boxoft installed, I tried that.  Like IrfanView, it had a command-line mode and a GUI mode.  I tried the GUI.  It had multiple options.  I liked it.  It did produce multiple JPGs per PDF.  They looked good.  I ran it again, this time selecting only page 1 (Settings > Common tab > PDF Convert Range), and that's exactly what it gave me.  So I wouldn't have to take a separate step of deleting JPGs for the pages other than page 1 of each PDF.  IrfanView didn't have that option, though it did have image editing options (if e.g., I wanted to change the dots per inch, size, or coloring of the resulting JPGs).

I could have continued to look at other options appearing in that search, but it appeared a working conclusion was to go with Boxoft and/or IrfanView, depending on the kind of output desired, and to make sure I was using just one stable, recent version of Ghostscript.

Saturday, March 10, 2012

Using Screenshots to Examine Many Files Quickly

I had a couple of projects that called for a way to examine a large number of files.  It seemed that screenshots could help in those projects.  This post describes the techniques I used.

EML Analysis

In one project, I was working with various email files that I had exported from Thunderbird.  These files had an EML extension.  Typically, if I viewed an EML file in Notepad, I would see various codes and other information that wouldn't be visible if I viewed it in an email program like Thunderbird.

I was interested in seeing the header codes in these EML files.  Those codes appeared at the tops of the files.  I felt that I could probably see what I needed to see in the first screenful of a Notepad session, opened maximized.

In other words, the concept was that I would open the EML file in Notepad; I would take a screenshot; I would save the screenshot; and then I would close the file and repeat the process with the next EML file on my list.  Then I would combine all those screenshots into one file, and flip through it or perhaps use other tools to analyze it further.  I wouldn't have to sit there, maintaining constant attention while the process continued in real time; I could just review the outcome afterwards.  (For some purposes, an alternative would have been to combine or select from the text, without a graphical view.)

The first step was to build the list of EML files that I wanted to examine.  I moved them all into a single folder and used DIR and Excel to give me the list and to convert it into a series of batch commands.  There was one such command for each such EML file.  Before running those commands, I had to open Notepad once, turn on its Format > Word Wrap option, and then close it.  The format of the command was as follows:

start /max notepad "D:\Folder Name\Email Name.eml"
That command was sufficient to open the EML file.  Next, I needed to pause the system for a moment, so that the file would have time to come onscreen. Among numerous suggestions, I favored a command involving PING ("ping 1.1.1.1 -n 1 -w 1500 > nul") because of its fine-tunable setting (in the example just given, 1500 milliseconds).  Unfortunately, that command's output component (" > nul") would have prevented me from adding more commands on the same line.  So I had to go with "TIMEOUT /T 1" for a one-second delay.

Next, I needed a command to take a snapshot.  It looked like there were multiple options here.  I had already installed NirCmd and had found it useful for other things, so I used this command:
start NirCmd savescreenshot "D:\Folder Name\Screenshots\Email Name.png"
NirCmd came with an option to copy its executable (nircmd.exe) to C:\Windows, so that this command could run without any need to specify the location of NirCmd, to put a copy of it in the current working folder, or to modify the computer's Path.  NirCmd wasn't saving to subfolders properly, so in the end I had to modify that part of the command.

Finally, I needed a command to close Notepad.  The advice that worked for me was:
taskkill /f /im notepad.exe
Note that this would close all currently open Notepad sessions.  These three steps (i.e., open the EML in Notepad, take a picture with NirCmd, close Notepad) would give me a screenshot of the first screenful's worth of the file's contents.  Collectively, those screenshots would give me a visual impression of the various kinds of codes appearing at the start of my EML files.

I used && to combine multiple commands on the same line, as a single (long) batch command. If that had failed, I could have added index columns next to the spreadsheet columns in which I built those two commands, with alternating even and odd numbers in those columns:  1 for the first Notepad command, 2 for the first NirCmd command, 3 for the second Notpad command, and so forth.  These index numbers would allow the various commands to be sorted into proper sequence in a single column, for copying and pasting into a batch file.

In short, for each EML file, I combined four commands with &&, into a single long command like this:
start /max notepad "D:\Folder Name\Email Name.eml" && timeout /t 1 && start NirCmd savescreenshot "Email Name.png" && taskkill /f /im notepad.exe
This gave me some PNGs.  Now there was the question of what to do with them.  One option was to simply stitch them together in a slideshow (using e.g., IrfanView) or a single PDF (using e.g., Acrobat).  I did a brief investigation of OCR software for that purpose.  Ultimately, I just used IrfanView, without even creating a slideshow, to arrow down through those PNGs, one at a time, at whatever pace I chose.  So I could look at whether each page came through OK.

PDF Analysis

In another project, I had a bunch of PDFs that I had created in a conversion process.  I wanted to check if the PDFs came through OK.  It would have been very slow to open them, one at a time, and page through them.  Combining them all into a single large PDF, which I could also page through, would have produced a huge file.  Also, if I was working with large PDFs or many PDFs (or both), I might have to look at huge numbers of pages.  Boredom or haste could lead me to flip past an important one-page document, while checking hundreds or thousands of less important pages.

Based on various factors (including the number of PDFs, their importance, and the time available), I decided to examine just the first page of each PDF.  I might not be able to tell if the whole document printed properly, but at least I could eliminate those instances where printing failed completely.

For this purpose, the process described in the previous section offered one possibility.  I could probably work up a set of commands to open a PDF, take a screenshot, and then close it, and then flip through the resulting screenshots.

I did not actually pursue that approach in this case, however.  Instead, I wanted to see if I could convert the PDF documents to JPG and then flip through just the first page from each such document.  If I had a hundred documents to check, I would have a hundred pages to look at -- not a thousand.  A separate post discusses that investigation.  The tool I chose was  Boxoft PDF to JPG Converter.  Another way to proceed might have been to split the PDFs first, using something like PDFsam, and then combine the PDFs of each resulting first page into a larger PDF that I could flip through.

Sunday, May 8, 2011

Windows 7: Verify That Data Files Are in Working Condition: JPG, MP3, PDF

I wondered if there was a way to test my data files, to make sure they would actually open without errors.  I posted a question on it, but that didn't get too far.

Eventually, I did find a couple of ways to test JPGs and other image files.  IrfanView was my favorite tool for this purpose.  I decided I wasn't really too concerned about corrupt spreadsheet and document files, since I rarely encountered anything like that.  I was in the habit of converting my documents into PDFs for storage.  JPGs, MP3s, and PDFs were probably the most numerous file types on my system, so I decided to focus on those for now.

For MP3s, a search led to a thread that identified a number of possible testing utilities.  I ran a search for several (i.e., MP3 Checker and Mpck, MP3 Diags, MP3Utility, and MP3 Validator) and came away with a preliminary impression that MP3 Diags and MP3Val were relatively popular.  None seemed to be listed on CNET.com, but I found MP3 Checker (2,111 downloads), MP3 Diags (3,387 downloads), and MP3val (1,925 downloads) on Softpedia.  It looked like MP3 Diags was being actively developed and had relatively good file correction possibilities, so I downloaded that.  The developer warned of potential data loss, so I decided I wouldn't necessarily use it to edit any MP3s until I was in a position to test them after the changes and make sure things had gone OK.  I ran it on a folder containing about 120 MP3s.  It ran for just a minute or so and identified problems with various songs (e.g., certain tags not found, low quality, two ID3V1 tags found when there should be no more than one).  It made these errors graphically visible, so that I could quickly see which files had the more worrisome kinds of errors (e.g., "Unknown stream found.  Since other streams follow, it is possible that players and tools will have problems using the file.)  In short, I liked MP3Diags.  Granted, I had not used it to fix anything.  But it made a good impression.

Now, how about testing PDFs?  A search did not yield much immediate help.  (A different search, later, was a whole different story, but I didn't get that in time for this.)  One suggestion was to automate printing them and see which ones printed.  It would have been possible to copy them all from various subfolders to a single subfolder, assuming duplicate names had first been resolved using something like DoubleKiller.  A Windows search would achieve this; so would a batch command using XCOPY.  From there, I could batch print to other PDFs, and perhaps the printing process would identify bad files.  I wondered whether an IrfanView conversion (as used in JPG testing) would do the same thing.  I tried opening a PDF in IrfanView and got an error:

Decode error !
Can't load Ghostscript or Ghostscript error.
Install Ghostscript from:
http://sourceforge.net/projects/ghostscript/
or
http://sourceforge.net
The latter appeared to be the current master site for Ghostscript.  I thought I did already have it installed, but perhaps not the latest version.  I tried using Irfanview (File > Batch Conversion/Rename) to convert several PDFs to JPGs, but got an error that way too:  "Error!  Can't load [filename].pdf."  To update Ghostscript, I downloaded and installed what looked like the Windows 32-bit version.  I tried the Irfanview conversion again, and that worked.  So it wasn't going to be necessary for me to explore the alternative of using PDFtoHTML, which would apparently require me to install Windows versions not only of Ghostscript and PDFtoHTML but also PDF2HTMLgui, which looked like it might be hard to find -- never mind the alternative of installing Xpdf, apparently an alternative to Ghostscript, or the approach of installing some relevant program (PDFtoHTML, I think) via GnuWin, which was going to be simplified by installing GetGnuWin.

Fortunately, I didn't even have to think about all that.  I just ran an IrfanView batch process on a bunch of PDFs.  To test if this was going to work properly, I inserted a bad PDF among those being processed.  To create a bad PDF, I searched for a hex editor, downloaded HexEdit, opened a copy of a small PDF file, looked in the ASCII pane (the right-hand one, in HexEdit; the one with occasional text rather than all numbers) for a reference to Root ## 0 R. (in my case, it was Root 9 0 R.), and change ## to 00 (so in my case, it came out being Root 00 0 R.), and then saved and tried it out.  Sure enough, when I tried to open the bad PDF, I got "There was an error opening this document.  The root object is missing or invalid."  So now I ran an IrfanView batch conversion of PDF to JPG, including that bad file (putting the output in a folder called X, which would cue me that I could delete the whole thing without looking at it).  Of the four files I tried to convert, three converted OK.  The bad PDF gave me an error in IrfanView and nothing in the output folder.  So then I would be able to just save the IrfanView report and examine the error messages; or if that failed, I could hunt around for a suitable folder comparison tool, or use a spreadsheet to compare folders, so as to work up a list of the PDFs that had failed the conversion process.

The spreadsheet approach, used with a command line process, might be best for those situations where the files I wanted to test were scattered across multiple folders.  What I would want, in that case, would be the ability to execute a batch command containing commands of this general form:
convert D:\Folder1\File35.pdf to D:\TestFolder\File35.jpg
convert D:\Folder2\File18.pdf to D:\TestFolder\File18.jpg
A problem there was that File35.jpg might already exist in TestFolder.  This could happen because there could be files named File35 in two different source folder, and now that would become evident when I tried to put them both (in JPG format) into one target folder.  One way to avoid that would be to begin with a DoubleKiller search for JPGs with duplicative names (having previously done a DoubleKiller search for files of any sort that had identical sizes and CRCs).  Alternately, I could test my spreadsheet-generated commands to see if they were going to produce duplicate filenames, and add a formula to change them as needed.  As for the "convert" part of that ideal command (above), I posted a question in the IrfanView forum, and then found a suggestion that the command I wanted would be like this:
i_view32 D:\Folder1\File35.pdf /c=d:\TestFolder\File35.jpg 
They said this (specifically, the "c=" option) would work to convert among all formats that IrfanView could handle except AVI, MOV, MPG, WAV, and MID.  (There would presumably have been PATH problems if I'd been running the portable version of IrfanView; the command line presumably wouldn't have known where to look for a non-installed program executable.)  Later, in response to the question I posted, someone said that, of course, I should have just gone into IrfanView's F1 (Help) > Contents tab > Overview > Command Line Options.  Which, when I finally did that, wow, there were a lot of them.  That help piece began with the advice to "See the 'i_options.txt' (IrfanView folder) for the most recent version of all command line options."  That file said I could use "/convert=" rather than just "/c=" and also that I should "See pattern help file page for more options."  At first, I thought that referred back to the F1 help page I had just come from; it had some conversion examples.  Those examples seemed mostly to show how I could include other command-line options at the same time.  One interesting option:  /filelist=txtfile would apparently use filenames contained in a file called "txtfile," so that apparently I would not have to repeat this command in full (on the command line or in a batch file) for each file being processed.  It said the conversion command would support wildcards.  Then I noticed that the pattern page was actually in a different place in IrfanView help:  it was under Options Menu > Text/Pattern Options.  There were variables or "placeholders" for a variety of components (e.g., $D was shorthand for the full path of the file being converted).  This seemed to mean that a command like "i_view32.exe d:\Folder1\*.jpg /c=d:\$D$N.pdf" would convert all the JPGs in Folder1 into PDFs.  I was going to have to play around a bit to understand clearly how that worked.

At the time when I closed this post, this process was still underway.  Additional steps I took were to run DoubleKiller for duplicative JPG filenames and then to do a directory listing of all JPGs on my drive.  To do that, in a CMD window, I went to the root folder (i.e., D:\ ) and typed this:  DIR *.jpg /a-d /s /b > JPG-List.txt.  That gave me a text file (JPG-List.txt) showing where all the JPGs were.  I put that into a spreadsheet and tested for duplicate output filenames.  Having already worked through duplicate filenames in DoubleKiller (by exporting the list of duplicates and generating batch-renaming commands in a spreadsheet), I did not find any duplicates now.  But I could tinker with filename extensions (e.g., .bmp, .jpg, .jpeg, .tif) and perhaps find that the same file existed under multiple names.  This was not exactly the same question as whether I had duplicates of the same photo; this was more a question of whether I had duplicate files under similar names.

Sunday, June 13, 2010

IrfanView Error: Windows Can't Play This File

I was using Windows XP SP3 as the guest operating system in a VMware Workstation 7 virtual machine (VM) on Ubuntu 10.04 (Lucid Lynx).  For some months, I had been using IrfanView to play various audio and sometimes video files in that VM.  Suddenly, with a number of files, I started getting this error message:

IrfanView
Error:  Windows can't play this file!
Windows error text:  The specified file cannot be played on the specified MCI device.  The file may be corrupt, not in the correct format, or no file handler available for this format.
You can try to install additional video/audio codecs from this site:
http://www.fourcc.org/indexcod.htm
or try the DirectShow option in 'Properties->Video'
At first I thought this was a problem with IrfanView.  I upgraded to the most current version of IrfanView and tried again.  The error was still there.  I tried playing the file in Windows Media Player (WMP).  I got this message:
The file you are attempting to play has an extension (.wav) that does not match the file format. Playing the file may result in unexpected behavior.
Do you want the Player to try to play this content?
I said Yes.  It took a few seconds, but then it was able to play the file.  So yes, IrfanView was not handling it as well as WMP, but both of them were telling me there was a problem with the file.  And then I knew what the problem was.  I had bulk-renamed a bunch of files, and had inadvertently named some *.wma files to be *.wav files instead.  I renamed this file to be filename.wma instead of filename.wav.  Now IrfanView was able to play it without a problem.

I was surprised to encounter this problem.  IrfanView had an "Ask to rename if incorrect extension" option, and I had enabled it.  That option had often asked me if I wanted to rename a file that had somehow acquired an incorrect extension.  Why not this time?  Apparently IrfanView was not able to detect the problem in this particular scenario.  I checked what codecs I had been installing.  I was not too sure what codecs were all about, and for some years I had been using K-Lite Codec Packs as a sort of all-purpose Band-Aid.  But as I checked on it, it appeared that I had just been reinstalling the same old copy of version 3.5.9 or possibly 4.7.0, whereas K-Lite was now up to version 6.0.4.  So I downloaded and installed the latest 32-bit K-Lite Mega Codec Pack.  It was a big honker -- 25MB -- but my understanding was that, if somebody sent me a file of a Mongolian shepherd beating on a bucket and recording it on a 1960-era IBM tape drive, this would be all I would need to enable Windows to play it in five-channel glory with four-part harmony.

Saturday, June 12, 2010

Ubuntu 10.04: IrfanView and Other Portable Apps via Wine

According to Tom Wickline, the process for installing IrfanView 4.23 on Ubuntu 8.04 was just a matter of installing winetricks and MFC42.dll and then installing IrfanView.  I wasn't sure how to do each of those steps, and I wasn't using quite the same setup as he was.  This post traces through my own installation process.

I was using Ubuntu 10.04 (Lucid Lynx).  I had just downloaded IrfanView 4.27, and thought I would try to install that latest & greatest version.  Also, unlike Tom's system, mine was not "a clean configuration directory, with no other applications or games installed."  According to Ubuntu's System > Administration > Synaptic Package Manager, I was using Wine 1.2.

My first hurdle was to figure out how to install MFC42.dll.  A WineHQ webpage said that I could get MFC42.dll from Microsoft or via winetricks.  They said I might already have gotten winetricks installed during my Wine installation, but they also said that I could run it even if it wasn't installed; I would just have had to type "sh winetricks" instead of just "winetricks" to run it.  I checked Synaptic.  Sure enough, there it was.  The purpose of winetricks seemed to be to add Windows-friendly support files so that Wine would run Windows programs.  That sounded about right.  The winetricks webpage listed MFC42.dll among the files that it was prepared to help me with.  I went ahead and typed "winetricks mfc42.dll."  That ran and appeared to change some settings.  I went into the wine subdirectory under my Ubuntu user folder:  File System/home/ray/.wine/drive_c/windows/system32.  Tyler Style had said that it needed to be there, but it wasn't.  Amusingly, he had posted that a few months earlier in response to my previous attempt, a year earlier, to get IrfanView running in Ubuntu.  Well, I thought, maybe MFC42.dll had known what it was doing when it installed itself; maybe Tyler was wrong as to the location where it would be found.  The other thing he said that I needed to do was to go into Applications > Wine > Configure Wine > Libraries tab and register MFC42.dll there.  I typed mfc42.dll into the "New override for library" box, at that location, and clicked Add.  It seemed to accept it:  it listed "mfc42 (native, builtin) as an Existing override.  I clicked Apply > OK.

This was fine, for whatever it was worth, but it didn't add IrfanView to my program menu.  To install IrfanView, I had gathered somewhere that I needed to type "wine iview427_setup.exe" to install IrfanView.  I tried that.  It replied with this:

wine: cannot find L"C:\\windows\system32\\iview427_setup.exe"
That raised two questions, which may be summarized as "why not?" and "so what?"  I didn't know why the error message had put that L in front of the C, but whatever; I had since discovered that, in Windows, IrfanView would install as a standalone program, and had therefore moved it to a different partition where I kept all of my Windows standalones (so that I wouldn't have to reinstall them whenever I had to reinstall Windows, but could instead just copy the whole folder to drive D (or whatever) on the new computer.  In other words, I wondered whether I could skip the installation; I wondered whether Wine could run portable or standalone programs.  According to MoebusNet, it could, and one way to make it do that was to download and install PortableApps to the USB drive where you were going to keep your portable programs.  In my case, I wasn't going to keep them on a USB drive; I was going to keep them in a folder on my hard drive.  I wasn't sure how that would work, but I gave it a try.  I downloaded and ran the little 2MB PortableApps Platform.  They said it was self-contained -- PortableApps was, itself, portable -- so I wondered if I could install it on the folder on my hard drive where I kept my other portable programs.  After a brief search, I decided the best way to find out was just to try it.  So when it came time, in the installation process, to choose the install location for PortableApps, I named that folder as the destination.  When the installation finished, in Windows Explorer I copied my IrfanView portable folder to the PortableApps folder.  (I kept a copy in the original location so that it would be available outside of Portable Apps as well.  I thought I would probably prefer to run it that way from my WinXP boot.)  I deleted iv_uninstall.exe from this copy, since I didn't want the uninstaller to show up in PortableApps.  I created a shortcut to PortableAppsPlatform.exe and put that in my Start Menu.  I started up PortableAppsPlatform and, following instructions, clicked on its Options > Refresh App Icons.  I clicked on the IrfanView icon and, sure enough, IrfanView started up.

So now that I had acquired this lovely knowledge about PortableApps, it was time to get back to what MoebusNet had started telling me, about running portable apps in Ubuntu via Wine.  I typed this:
wine "/media/DATA/Standalones/PortableApps/PortableApps.com/PortableAppsPlatform.exe"
and that worked:  IrfanView started up.  So the concept seemed to be that any portable app that I would put into a folder on the same level as the PortableApps.com folder would show up when I ran that command.  So I could make a single PortableApps menu pick for Ubuntu, and it would lead, via PortableApps, to any portable application program that I would set up that way.  I set up a launcher for that wine command by highlighting, right-clicking, and copying it into the Ubuntu Applications menu:  right-click on Applications and choose Edit Menus > Applications > Accessories > New Item.  Name it PortableApps, paste the copied command into the Command box, and Comment it as "Launch portable Windows applications."

This was all wonderful.  But when I tried to play a .wav file in IrfanView, I was still getting the same error message from the previous year, the one that Tyler Style had tried to help me with.  The message read as follows:
IrfanView
Error:  Windows can't play this file!
Windows error text:  Invalid MCI device ID.  Use the ID returned when opening the MCI device..
You can try to install additional video/audio codecs from this site:
http://www.fourcc.org/indexcod.htm
or try the DirectShow option in 'Properties->Video'
The fourcc.org/indexcod.htm webpage seemed to offer video but not audio codecs.  Some Ubuntu documentation pointed me toward the Ubuntu restricted extras repository.  I thought I had already set myself up for everything I could get from there, but the documentation was saying, "Installation only works completely and properly when done from the command-line Terminal. The entire package will not usually install completely from within a Package Manager."  So possibly Synaptic had not brought me all of the codecs I needed.  I killed IngrfanView and then, obeying the documentation, I typed this:
sudo apt-get install ubuntu-restricted-extras
but it said I already had the newest version.  I could have tried completely removing and reinstalling ubuntu-restricted-extras, but that sounded like it could lead to other difficulties.  Besides, another post made it sound like the codecs might actually be in Medibuntu, which I had also installed.

There were two other things to think about.  One was that I might just try a different audio player.  I posted a question on that.  The other was that I maybe I should take a shot at that actual error message.  What did "Invalid MCI device ID" mean?  Turns out I had posted a bug report on it the previous year.  I posted an update to that bug report.

Meanwhile, in response to the question about an alternative audio player, I got a suggestion to try an older version of IrfanView (namely, 3.98), or to try mpg123 if my reason for wanting IrfanView was to enable skipping to the next file in a folder with just one keystroke.  IrfanView 3.98 dated from 2005, so I would be missing out on some newer functionality.  It didn't seem to be available on the official IrfanView site, but I found numerous other locations for it.  It was a bit harder to find the plugins for version 3.98, but eventually I did.  I installed 3.98 and its plugins on a Windows XP machine and then moved the installed folder over to the Ubuntu machine.  I deleted the previous IrfanView folder from the PortableApps folder, and put this new IrfanView 3.98 folder into PortableApps in its place.  (This time, I didn't keep a copy outside of PortableApps, since I didn't plan to run 3.98 in WinXP.)  Once again, I deleted the Uninstall.exe file from this IrfanView 3.98 folder.  I went to Ubuntu's Applications > Accessories > PortableApps > Options > Refresh and then clicked on IrfanView.  It opened up.  I went to Help > About.  Sure enough, I was now running version 3.98.  To test it, I hit Print Screen.  This opened Ubuntu's Save Screenshot dialog.  I clicked Copy to Clipboard, moused to IrfanView, and hit Ctrl-V.  Sure enough, I had the screenshot in IrfanView.  I tried cropping it (left mouse click / drag / release, Ctrl-Y), set View > Display Options > Fit Images to Window, and, sure enough, IrfanView was functioning normally.  Cool!

To try IrfanView's audio functioning, I navigated to a folder containing several .wav files, double-clicked on the first one, and it played -- in Ubuntu's Totem Movie Player.  Oops.  I right-clicked on the .wav, but Ubuntu wasn't listed as a possibility for the program to play it in.  I went back to PortableApps and started IrfanView again.  I went into its Options > Properties -- but, of course, I had already set those.  So, a problem:  could I get Ubuntu to treat IrfanView as the default viewer or player for a filetype?  My first search didn't turn up much.  PortableApps had a live support chat, but no joy for me there, so I posted a question on it in a PortableApps forum.  Then, resuming my tinkering, I right-clicked on the .wav again and chose Open With > Other Application > Wine Windows Program Loader, but that gave me "Error:  There is no Windows program configured to open this type of file."  Well, I had definitely configured IrfanView to do so, but maybe Wine didn't agree.  I tried a search for that error message, and followed one particularly painful thread from that search.  Somewhere along the way, I got the idea to try Ubuntu's Applications > Wine > Configure Wine > Applications.  With Windows XP as the version of Windows specified at the bottom of the dialog, I clicked on Add Application and navigated to the folder where I had put PortableApps; and in there, I navigated to the IrfanView folder, selected i_view32.exe, and clicked Open > OK.  Now I went back to the original Ubuntu right-click on the .wav, selected Open With > Wine Windows Program Loader . . . and still got the same "no Windows program configured" error.

I had forgotten the option of installing IrfanView as an Ubuntu application via Wine.  Following my steps from a year earlier, I navigated to the IrfanView 3.98 folder and typed "wine i_view32.exe."  But no, that wasn't right; that just ran the portable version.  That command-line approach wasn't necessary anyway; I discovered that I must already somehow have set up Wine to run .exe files automatically, apparently following advice like that provided by a relevant Community Documentation page.  All a bit puzzling.  I continued playing and posting on it, trying to dig my way out.

Meanwhile, I experimented with mpg123.  Some time had passed, and I couldn't remember if I had already installed it, so I just typed "mpg123" at the Ubuntu command line.  This gave me an odd error message:
The program 'mpg123' is currently not installed.  You can install it by typing:  sudo apt-get install mpg321.
What was odd was that the installation line said mpg321, not mpg123.  I checked Synaptic.  It confirmed that I didn't have mpg123 installed yet, and it also showed me a program called mpg321 on the next line.  The description of the latter characterized it as an "mpg123 clone that doesn't use floating point."  Apparently someone at mpg123 decided that mpg321 was a superior alternative, and thus gave me that command line suggestion to use mpg321 instead.  Just to be sure, I did a search and got the impression that mpg123 began as nonfree software, so mpg321 was prepared as a free alternative and it just became more popular.  I installed both of them in Synaptic, but after playing around with them for a half-hour or more, I was still not getting playlists to work properly.

I found a page listing top Linux music players.  I looked at the webpages for several on that list, but none of the six or eight pages I looked at provided a simple explanation of how the players actually worked -- of whether, to cite an example, you could hit the 6 key on the numeric console at the right end of a standard keyboard to move on to the next file, as you could do in Winamp.  From that list, in the name of trying something rather than nothing, I installed Audacious.  It was a nice enough player, but it did not have the ability to delete a file that I was listening to, as IrfanView did.  It was also not as responsive:  IrfanView would stop immediately when I told it to, so that I could mark a file for resorting or other handling; Audacious would continue on for maybe a second or so, which is not much except when it results in the program's moving on to the next file, which was not the one that I wanted to delete, re-listen to, or otherwise handle.  I decided, once again, that what I wanted was undeniably IrfanView, until further notice.

By this time, Ringi had replied to my latest post in that thread.  It seemed that s/he was doing just fine with the latest version of IrfanView in Ubuntu.  Since there seemed to be no need for 3.98 after all, I deleted the IrfanView 3.98 folder from PortableApps and replaced it (again, without the uninstall.exe) with a copy of 4.27.  Ringi asked whether I had installed IrfanView's plugins, and that was a good question; I was not sure.  Actually, by now I wasn't even sure I had actually installed IrfanView via Wine; it wasn't appearing in Applications > Wine > Programs.  Returning to my notes at the start of this post, I decided that the PortableApps thing was a dead end, at least for purposes of getting IrfanView to run the way I wanted.

I went back, specifically, to the advice (above) that I needed to type "wine iview427_setup.exe" to install IrfanView.  In Terminal, I navigated to the original setup folder (i.e., not the unpacked, ready-to-run standalone folder) where I had stored iview427_setup.exe and irfanview_plugins_427_setup.exe.  I typed that  Wine command:  "wine iview427_setup.exe."  It said, "err:module:import_dll Library MFC42.DLL (which is needed by L"D:[path]\iview427_setup.exe") not found."  So, OK.  I had not correctly installed MFC42.DLL after all.  Following the Winetricks instructions, I typed "sh winetricks mfc42.dll."  I got an error:  "Can't open winetricks."  I verified, in Synaptic, that I did have cabextract installed.  Synaptic also confirmed that I had winetricks installed.  Nonetheless, following those instructions, I typed "wget http://www.kegel.com/wine/winetricks."  It ran.  I tried "sh winetricks mfc42.dll" again.  This time, it said, "Unknown arg mfc42.dll," followed by a list of the packages that it did have.  Oops:  just plain mfc42, not mfc42.dll.  I retried:  "sh winetricks mfc42."  It ran without error.  So, interesting:  it seemed that Synaptic (or whatever approach I had used previously) had not done the job of installing winetricks properly.  Now I got a dialog for "VCRedist Installation."  I okayed through that; something ran in Terminal; and it concluded with this statement:  "Install of mfc42 done.  Winetricks done."  Cool.  I had finished the mfc42 part.  Now back, once more, to "wine iview427_setup.exe."  This gave me the IrfanView Setup dialog.  I set it to install for all users in C:\Program Files\IrfanView\.  It completed, and IrfanView was up and running.  I killed it and typed "wine irfanview_plugins_427_setup.exe."  That ran OK, and now I had an IrfanView entry in Applications > Wine > Programs.  I started IrfanView and set its options, including naming it as the default handler for all audio files.

So IrfanView now seemed properly set up for sure.  In IrfanView, I did a File > Open.  It was listing only image files, but I changed it to show all files, and then tried to play one of the .wav files in that folder.  It gave me the "Error:  Windows can't play this file!" message again, same as before.  I killed IrfanView, double-clicked on a .wav file in Nautilus, and the file played -- in Totem!  It certainly appeared that I had installed IrfanView correctly -- at least once, if not multiple times -- and yet it was still not functioning properly for me in Ubuntu.  I returned to a Wine bug report that I had started to file a year earlier.  I didn't know how to file bug reports, but I gave it a whirl.  The concept seemed to be that you get a debug trace on the uncooperative program.  In this case, that seemed to call for going to the folder where I had installed portable IrfanView and running the following command:

WINEDEBUG=+relay,+seh,+tid wine i_view32.exe &> /tmp/output.txt

That opened IrfanView and waited while I repeated the steps I had taken:  open a .wav file, get a repeated error message, etc.  When I closed IrfanView, the output file was there.  But when I looked in it, it only contained repeated instances of this message:  "fixme:mciwave:MCIWAVE_DriverProc Unsupported yet command [2115]."  That last number changed, in each of the six repetitions of that message:  2115, 2114, 2132, 2114, 2132, 2132.  Maybe that was all it was supposed to say.  Whatever.  I attached the output.txt file to the bug report and sent it off.  Meanwhile, I posted a link to this note in the discussion thread, in case Ringi or someone else felt like reviewing it and possibly detecting what I had done wrong.

Wednesday, July 29, 2009

Other Virtualization Solutions to Play Audio in Ubuntu 9.04

I was running 64-bit Ubuntu 9.04 (Jaunty Jackalope). I wanted to use IrfanView to listen to .wav files. I had been using it in a VMware Workstation 6.5.2 virtual machine (VM) running Windows XP, but I had lately been having a problem with stuttering audio playback, and my efforts to fix it had failed so far. It was possible that I had not correctly applied all of the suggestions I had encountered, so one option was to go back and review the recommended steps, perhaps by spending a few weeks working through the Comprehensive Video & Multimedia Howto. Since there seemed to be users whose problems persisted after trying those suggestions, however, I thought perhaps I should try out some alternatives. I posted a question about the VMware problem and left it at that for the time being, reserving the option of trying the supposedly surefire solution of installing a second sound card.

One alternative was to try running IrfanView directly on Ubuntu, with the assistance of Wine. I had made some progress on that, but that, too, was still pending resolution of a posted question. Another possibility I had overlooked was to use VMware Player instead of VMware Workstation. Player (a free download) had been installed when I had installed Workstation, and was now available to me in Ubuntu at System Tools > VMware Player. I opened a VM that I had powered down (i.e., that was not merely suspended) in Workstation. I hadn't really used Player before. I was pleased to see that it seemed to run VMs a little faster and simpler than Workstation.
I tried playing audio in VMware Player. To my surprise, both IrfanView and Windows Media Player played .wav audio files just fine, with no stuttering! I had shut down the machine the previous evening and powered it back up again that morning, so I wondered whether the cold restart had made a difference. I started up Workstation, resumed a previously paused VM, and tried playing .wav files in there. Those, too, played fine. Apparently the restart had indeed temporarily fixed the problem - might, indeed, have been the reason why the other solutions I had tried had seemed to work. I had rebooted the system previously, but it now seemed that I simply hadn't left it turned off long enough.
Since the problem seemed to be fixed, I abandoned (at least for the time being) the other possibilities that I had begun to explore. In case I (or someone else) needed them, however, that list of possibilities included the following:
  • Perhaps I could successfully run IrfanView inside a virtual appliance. These would seemingly be subject to the same VMware Workstation problems, but perhaps not, somehow. I searched the VMware Virtual Appliances webpage for IrfanView but, not surprisingly, found nothing. My Google Search for WinXP applications in the VMware catalog didn't seem to turn up anything special, but a search for "Windows 7" indicated that, for $10, I could download something called the Bagvapp RC Windows 7 beta. They said this thing also came with additional software installed. (Microsoft provided additional information on this free (possibly bug-filled) Release Candidate.) For ten bucks, of course, it made huge good sense to just buy the pre-installed VM from Bagvapp; but since I didn't really need it, I contented myself with signing up for Bagvapp's RSS feed. (Most of their stuff was free, but they said they were swamped with orders for the RC and had to pay for a ton of bandwidth.) There also seemed to be other free Windows 7 beta virtual appliances, such as one from Tuxdistro, although not all appeared to be as fully tricked-out as the one from Bagvapp. The Win7 RC, in any case, was said to be valid for another eight months, until March 2010.
  • In March 2009, Jonathan DiPrizio discussed four virtualization options in Linux. Those four were Qemu, Parallels, VMware, and VirtualBox. DiPrizio found VMware and VirtualBox to be the clear winners among these four, and actually preferred the latter. So I would have the option of trying to run IrfanView in VirtualBox, if the VMware problems continued.
  • I had also located Wikipedia articles on application virtualization and platform virtualization. These led to consideration of other possibilities, such as Microsoft Virtual PC and DosBox.

Tuesday, July 28, 2009

Installing and Using IrfanView for Audio in Ubuntu 9.04

I have an Olympus VN-960PC digital voice recorder (DVR). It saves its recordings in compressed .wav format files. When I listen to those recordings, I usually use IrfanView to listen to them. I have been using IrfanView for years, and have found it to be markedly more useful and flexible than any other program for many image editing, audio listening, file viewing, and other multimedia tasks. It is really amazing freeware.

I use IrfanView for this particular task because I have not yet found another program that allows me to move from one recording to the next so quickly. I listen to the notes I have saved on the DVR; I highlight some of them, one by one, in Windows Explorer, and then I cut and paste the selected recordings to subfolders for further use. I have developed the habit of beginning many of my recordings with a single word (e.g., "Monday" or "shopping"), so I know right away which folder it goes into. Sorting a number of audio recordings this way is very fast.
IrfanView was a Windows-only program. I could not find anything in the Linux world that could replace it, for my purposes, so I looked for ways to run it in Ubuntu. One possibility, which I used for a long time, was to run it in a virtual machine in VMware Workstation (or perhaps I could have used a freeware virtualization program) on Ubuntu. I was engaged in a long-term effort to move away from dependence on Windows, though, and sometimes virtual machines could be somewhat clunky.
Finally, at one point I reached a situation where I invested a bunch of time and still could not resolve a VMware audio problem. This seemed to be the opportunity to try running IrfanView, a Windows program, in Ubuntu. I planned to do so via Wine, which (in that wacky Linux way) is short for "Wine is not an emulator." The stable release of Wine at this point was 1.0.1, and that is the version that was available in Ubuntu's (System > Administration > ) Synaptic Package Manager. I searched for wine in Synaptic, marked it, and clicked Apply. It downloaded and installed the necessary stuff. Next, following the steps I had researched when I had tried Wine a year earlier, I proceeded as follows, typing these commands into Ubuntu's (Applications > Accessories > ) Terminal at the command prompt:
wget http://www.kegel.com/wine/winetricks
sh winetricks mfc42
Then, in Ubuntu's File Browser (Places > Computer), I navigated to the folder where I had saved the downloaded IrfanView program. This program was called iview425_setup.exe. I copied the Location of this folder from the address bar at the top of File Browser and put it, between quotation marks, after a cd command in Terminal, as follows:
cd "/media/CURRENT/Miscellany/Installation/Programs"
and then I typed the Wine command to install IrfanView:
wine iview425_setup.exe
This gave me the regular IrfanView Setup dialog, just as if I had been installing it in Windows. I told it to install a link on the desktop, and it did; but I could not get that link to run. So I used cd again, to get to where it had been installed (cd "/home/ray/.wine/drive_c/Program Files/Irfanview", where "ray" was my username), and typed wine iv_uninstall.exe. This removed everything except iv_uninstall.exe itself from that folder; I deleted that last file manually.
I decided to try an older, simpler version of IrfanView. I went to OldApps.com and downloaded IrfanView 3.0. Then, as above, I used cd to navigate to the place where the downloaded file was. In this case, the program (after extraction from the downloaded .zip file) was named i_view32.exe, so I used that instead of iview425_setup.exe in the installation command presented above, as follows:
wine i_view32.exe
Unfortunately, this installer did not run at all. About this time, I rediscovered Wine's reports on the various efforts people made to run different Windows programs under Wine. In particular, I found the reports on IrfanView. These, supplemented with the instructions and replies posted at Wine-Reviews.net, seemed to indicate that what I really needed was to use relatively recent versions of both Wine and IrfanView.
To get a version of Wine more recent than the one that was available in Synaptic (above), I had to modify Synaptic. That is, I had been using Synaptic out of the box, the way it came in the original Ubuntu installation; but Synaptic could be configured to look in additional places for more software. In this case, I wanted it to look in the WineHQ repository. So I went back into Synaptic and clicked on Settings > Repositories > Third-Party Software > Add. In the APT line box, following the WineHQ instructions for Ubuntu 9.04, I typed this:
deb http://wine.budgetdedicated.com/apt jaunty main #WineHQ
Then I clicked on Add Source. Next, while still there in Software Sources, I went to the Authentication tab and clicked on Import Key File. I didn't have the key file yet, so I had to go to the webpage that they call Scott Ritchie's Key to get it. I saved that page (in Firefox, the command is File > Save Page As). Its default name was Scott Ritchie.gpg, so I accepted that. So now, back in the Software Sources > Authentication > Import Key File window, I navigated to where I had saved Scott Richie.gpg and selected it. Then I clicked on Close > Close. Now, back in Synaptic, I clicked Reload. I could have done a Quick Search, there in Synaptic, to see that Wine now needed to be updated; but I decided instead to update everything on my system that might need to be updated at that point. So I closed Synaptic and went to System > Administration > Update Manager and installed everything it had for me.
Normally, it can be more convenient and/or easier to remember one's way around by using the Graphical User Interface (GUI), as just described. In this case, though, for some reason the whole thing about Scott Ritchie was a little weird and hard to remember (though not Scott Richie himself, oh, no, we'll never forget ol' Scott), and I would probably have found it simpler just to copy and paste these lines into Terminal from the bottom of the WineHQ instructions page:
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/jaunty.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get update
sudo apt-get install wine
but whatever. It was done, and I had my other updates to boot. Plus, I got a free opportunity to screw around with Synaptic. (Later, I discovered that I should have uninstalled the older version of Wine first. I also discovered that apparently I should have been doing my work in a folder dedicated to Irfanview.) Now, at any rate, I had some more recent version of Wine installed. To see which one, I went back into Synaptic and searched for Wine again. It was 1.1.26. This was more bleeding-edge than the 1.1.14 that they had used in that Wine-Reviews article. I wasn't sure how to get back to 1.1.14, though, and anyway that was a half-year earlier, and they were using Ubuntu 8.04, so maybe this was better for my purposes. The Wine-HQ report indicated that Sven Plaga had just recently used 1.1.25 with great success. The version of IrfanView that Sven had used was apparently 4.25. He had used it with a beta release of Ubuntu 9.10, which I wasn't up to yet; but if it worked now, I figured that might defer whatever updating I might otherwise have to do later.
So now I tried again to install IrfanView on this newer version of Wine. I had already done the whole winetricks and mfc42.dll routine (above), so this simplified the process for me. Following the Wine-Reviews and Wine-HQ instructions and comments (with some help from some older Ubuntu Community Documentation), I repeated the foregoing steps of navigating to the folder where I had stored iview425_setup.exe, and then I typed this:
wine iview425_setup.exe
The installer ran, but again I couldn't get IrfanView to start. This time, though, it was not surprising. According to the instructions, I next needed to go into the installation directory (in my case, /home/ray/.wine/drive_c/Program Files/IrfanView) and delete the i_view32.ini file. The comments indicated that IrfanView would replace it with a simpler i_view32.ini that would cause no problems. I had forgotten to download and install the IrfanView plugins, so I did that now:
wine irfanview_plugins_425_setup.exe
Now I had an embarrassment of riches, in terms of IrfanView launchers. There were three different Ubuntu icons on my desktop, and they all worked. I deleted the two that didn't have the Ubuntu red cat (or whatever that is) on them. I also saw that Wine had installed itself as an option under Applications on the Ubuntu menu, and under Wine > Programs I had an IrfanView menu plus an apparent freebie, a link to an actual working copy of Notepad.
The key question, now, was whether IrfanView would now function in Ubuntu as it had functioned in Windows, for purposes of listening to and moving through .wav files. I went into IrfanView's Options > Properties and adjusted the settings to my preference. Then I double-clicked on an audio file . . . and watched it open in Totem Movie Player. OK, so this was my opportunity to learn how to set the default application program in Ubuntu. I started to Google for some guidance, and then I realized this was probably somewhere under System > Preferences - and, sure enough, there it was: Preferred Applications. I went to Multimedia and indicated that I wanted to use a Custom multimedia player. I right-clicked on the IrfanView desktop icon and went into its Properties > Basic tab. I copied its Command line to Terminal, to try it out. It worked: IrfanView started. So then I copied that same command line into the Multimedia command box. But either way, with or without the "Run in terminal" box checked, it didn't default to IrfanView; I was still getting Totem. So yes, I had to Google the question after all. The answer was easy enough (apparently a lot easier than it had been a year earlier): right-click on a .wav file and select Properties > Open With > IrfanView > Close.
Ah, but now, when I double-clicked on a .wav file, I got an error message:
Error: Windows can't play this file! Windows error text: Invalid MCI device ID. Use the ID returned when opening the MCI device.. You can try to install additional video/audio codecs from this site: http://www.fourcc.org/indexcod.htm or try the DirectShow option in Properties->Video.
Weird thing: I got that same error message three or four times in a row. I'd click OK, and there it would be again. And then, when it stopped, I got a little "No Device" window and the audio file played after all. But then that No Device window wouldn't go away; I had to kill IrfanView to banish it. I went into IrfanView's Properties and tried clicking the DirectShow option as advised. Same result. Seeking truth, I went back to Google. And I could tell that I was at last getting close to the truth indeed, because this time my search turned up only a small number of results, none of which seemed relevant. Fortunately, I was able to revise my search into something even less helpful. As the day drew to a close, I posted a question on this at Wine-HQ. Someone there suggested that I should post it as a bug in Wine, so I did that. I didn't know how long it would take them to address and resolve this bug, if that's what it was, so I decided it was time to post this message as-is and think about other ways of getting Irfanview to work.

Wednesday, January 2, 2008

How to Print a Long Webpage or Image File

I took this question to the Adobe Acrobat Windows forum. It drew a couple of responses, but no real answer. Here was the problem. Acrobat gives you the option of printing a webpage to PDF. Usually, it works just fine: you print the webpage, Acrobat breaks it up into a bunch of 8.5 x 11 sheets (if it's a long webpage), and you have a PDF document containing a reasonably good representation of the webpage. Sometimes, unfortunately, it does not work that way. Instead of printing the entire webpage to PDF, Acrobat prints just the first and last pages, or maybe just the first page. I think the reason must have to do with the HTML coding of the webpage. Whatever: point is, you can't PDF the webpage. This happens for some long image files too. For instance, I thought of using the ScreenGrab extension in Firefox to save the irritating long webpage to JPG or PNG format, and then using an image editor (e.g., the highly recommended freeware IrfanView) to print the PNG to PDF. But this didn't work either: I still got the same outcome. Likewise if I first saved the webpage to different forms of HTML files on my local drive. Eventually, though, I came to a simple solution. Instead of trying to print to 8.5 x 11-inch paper, save the long webpage to a PNG, and then set Acrobat to print to a sheet that is 92 x 92 inches. There are many webpages that are still too long for that, but it's not a bad size. If you need to convert that outcome to 8.5 x 11, then maybe you can print the 92" PDF to an 8.5 x 11 PDF size. In my experiments so far, this approach gives me fonts that look pretty much normal, viewed at a page width display setting. They are good enough to OCR in Acrobat.