The Mudcat Café TM
Thread #45197   Message #695013
Posted By: JohnInKansas
21-Apr-02 - 04:04 PM
Thread Name: Tech: Converting PDF Sheet Music
Subject: RE: Tech: Converting PDF Sheet Music
John in Brisbane (mainly)

I'm not sure whether you got an answer to your earlier question about "copying to the printer."

The most reliable method I have found for copying a file directly to the printer is by using the DOS COPY command. In DOS you actually copy the file to the "port" to which the printer is connected; and with Windows that may not be what you expect. It is necessary to distinguish between the "hardware" port, where "hardware" LPT1: is the parallel connector on the back of your PC, and the "logical" port(s) that Windows can create.

Even though your printer is connected to "hardware LPT1:" Windows may call it LPT3: or LPT4: or something else. It will probably be called LPT-something, even if it's connected to a USB or network port, although there are no guarantees here.

In the past, when I had a PostScript printer connected directly to the mechanical LPT1 port of my PC (and didn't have GSView on that machine), I generally used a DOS COPY to send .ps and .eps files to the "hardware" LPT1: To copy "filename.ps" to the hardware LPT1 port, the DOS command needs to be entered as:

  COPY filename.ps LPT1.DOS

The ".DOS" tacked onto the port name tells DOS that you're talking about the hardware port.

Because of the size of my .ps files, my printer frequently "timed out" and the print failed at least partially. The software command to set any HP Laserjet (Hewlett-Packard) printer to "infinite timeout" is:

  MODE LPT1 ,,P

I made a "batch file" containing:

  MODE LPT1 ,,P
copy %1 lpt1.dos

Saved as a text file with filename "psprn.bat" and placed somewhere in the DOS PATH (C:\ root usually works well), I could open a DOS window, navigate to the file I wanted, and use the DOS command:

  psprn filename.ps

to set the printer timeout to "infinite" and copy the file directly to the PostScript printer.

If you have some other setup (my current one uses a separate print server on my LAN) you need to look at the properties for your printer (Start, Settings, Control Panel, Printers in Win95/98; Start Settings, Printers in Win2000). Right-click your PostScript printer, select properties, and click the Details tab. It should tell you the port name that printer uses (I have one printer with several different drivers that shows up as LPT3:, LPT4, LPT5, and LPT6.) Use the LPTx: part (the properties tab may show some additional info) of that name in the DOS COPY command (without the ".DOS") and your file should go directly to the printer.

The "Windows" method of dragging a file onto a printer icon on the desktop doesn't really work as a "copy." If the file type is "registered" to open in some program, it will open in the registered program and then will print from the program which is not the intent of the copy operation.

While a .pdf file is a "subset" PostScript file, my trials indicate that copying one to your PostScript printer will not normally work. Apparently the Adobe Acrobat Distiller puts a modified header on .pdf files that will not "turn on" the printer's PostScript interpreter. Most printers, PostScript and others, will default to "lineprinter" mode, and try to print the "characters" it receives. Since the .pdf file is almost entirely in hex, you're likely to get several hundred blank sheets of paper, with just enough messed up to prevent reusing them. Mileage on this may vary with your specific printer model, but using the free Acrobat Reader and a normal print operation is the recommended method for printing .pdf files; and if you do it that way, you don't need a PostScript printer. You can also use GSView, but frankly the Acrobat Reader is a more thoroughly "domesticated" program, and results are more predictable if all you want to do is view and/or print.

It should be noted that when browsing the net, if you can see it you can usually right click and print it. Results will vary, especially on sites with a lot of "border" or multi-popups.

PDF files downloaded from the web can have printing from Acrobat Reader blocked. They may also be pre-set to full screen display, so that toolbars are hidden, and may block the normal Esc key toggle to normal view. Frequently, if you can "back out" to a link to the page, you can right-click on the link and select "save target as." Often you'll get a clean pdf (or .mid, etc) without the "blocking." (Don't tell too many of the webmeisters about this one.)

As tot the purpose of all this:

MIDI files are very compact, since essentially they consist of a string of "turn on this note" (one byte) and "turn off that note" (one byte). Count the notes and multiply by two and add a few for the header, and you've got the file size.

The big advantage of midi is that a player is built into virtually everybody's Windows (or Mac). A secondary advantage is that almost any notation program can "make the dots" from a midi. The disadvantage is that the file is in binary, so it's not printable as text and has to be sent as an attachment.

ABC files are similar, except that it's "turn on this note" (one byte) "for this long" (one byte) so the file size is pretty much the same as for a midi (oversimplified, of course). The advantage is that they're plain text, so you can transmit them as part of a document. The "user" does have to cut them out of the page, save as .abc, and get and use an abc capable player.

The MID2TXT/TXT2MID suite pretty much wipes out the difference between midi and abc portability, for those (on Mudcat) willing to get it and use it.

My understanding is that both midi and the latest version(s) of abc can include lyrics, but it does make it somewhat more difficult to create consistent files. It would introduce some learning requirements for contributors to be able to do much with this.

I like to see the dots, so PDF files are an ideal way to have things posted for my use, although a normal .pdf means I have to transcribe it to make the midi.. Probably the majority of others though would rather hear the music. Since most notation programs can make the dots from the midi, the .pdf would have to be set up so it's consistently "prettier" than what I get from the midi with my own notation software if it's to be a particularly great benefit.

I'm not sure how you are thinking of making the .pdf or .ps file "play itself," but I believe you can include links in a .pdf fairly easily, so perhaps just posting both with an embedded link from the .pdf to the .mid (or abc) would meet the need.[[[PostScript AND html????]]]

One of the problems with compiling and maintaining a large database is that there must be some "focal" person (or small group of people) to make sure that things are in consistent format. A format must be selected that can be produced consistently for the majority of the data items. (One of the reasons, as I understand it, why we don't have midis with embedded lyrics.) Most people will have some difficulty in making edits or corrections directly to either .ps or .pdf files, so it might be better to have things come to the focals in some other "printable" form. While .ps files are technically printable, editing requires either appropriate software and/or significant skill. Distilling to .pdf is fairly straightforward, once the editing is done. Then only one (or a very few) copies of Adobe Distiller or GSView would be needed, and only a few would really have to learn it?

I'm not sure I see an advantage to converting .pdf files to some other graphical format, but I can see possible arguments for and against it.

Some good ideas. Go forth bravely, and let us know what's developing.

John