The PDF Converter is designed to convert a PDF file into an image format that is suitable for display on a Newton MessagePad or eMate.  The program can generate output for a Web Browser, or for Newton Book Maker. The output could probably also be used for Newton Press, if uou can get that program to work correctly.

The output is in an image format, rather than HTML or some other formatted text.
The reason is that it is virtually impossible to render a page accurately outside of a PDF, especially on a Newton. Many page elements, such as rotated text, are not available outside of PDF, at least on a Newton.

Therefore, PDFConvert writes its output to image files that can then be loaded onto the Newton and viewed in precisely their original format, with all of their fonts, graphics, shading, etc. Note that depending on the desired resolution, and on how many graphics the original PDF contained, the converted document will be two to ten times larger than the original PDF.

The PDFConverter program itself is written in Java 2, and should run on any computer that supports Java 1.3 or 1.4. Unfortunately, the "classic" MacOS (8.x or 9.x) does not have a Java 2 runtime available, and therefore can not run PDFConverter, although the BookMaker output is formatted for the Mac version of BookMaker.


This document assumes that you have looked at the readme file (in the same directory as this file). This document also assumes that you have read Hendrik Lipka's PDFConv web page:

http://www.hendriklipka.de/newton/pdfconv.html


This document describes the changes for version 0.1.3 of the PDF Converter, and also has some suggestions for its use.

Suggested Operation of the Converter:

HTML Output
-----------
If your Newton has a TCP/IP connection and you have a web server available to which you can upload your files, then this is the easiest option for using PDF Converter.  The steps are as follows:

1. Install a Java 2 runtime if you have not already done so.

2. Unpack the PDFConv.zip file into a directory on your hard disk.

3. Copy your PDF into the same directory as the run.bat file.

4. Run the program. On my Windows NT machine, this would be:

   D:\PDFConv> run "-source=myfile.PDF" "-basename=myfile"

   (I don't know why you need the quote marks, but you do.)

   The "source=" is obviously the name of your PDF.
   The "basename=" will be used as the of your HTML file, and the prefix of the 
   filenames of the JPG files that it references. 
   It will also be the <Title> of your finished document.

   There are additional command-line arguments to specify the size and quality and location
   of your JPG images. See the readme for more information.

5. Upload the .html file and the .jpg files from the output directory to your Web server. The output directory will be under the directory that has your run.bat file. In the example above, it would be D:\PDFConv\output .

6. Install Newtscape on your Newton if you have not already done so:

http://mywebpages.comcast.net/saweyer/newton/newtscape.htm

Make sure that you have the JPG plugin (JPEG10f2.pkg) and the NewtPack plugin(pack32.pkg) installed. I also recommend turning off image scaling in Newtscape, since the text will be too small to read. To turn off scaling,
uncheck i->General->Images->scale to fit.

7. Connect your Newton to the Internet, and launch Newtscape. Open the URL for the html file that you uploaded to the web server.

8. Once the pages appear on-screen, you can read them on your Newton, or select File->Save as Package to save the document as a Newtonbook.

9. You can then erase the pages from your web server, if you want to.


BookMaker Output
----------------

If you don't have a web server available, or you do not have a TCP/IP connection on your Newton, you can generate a NewtonBook on your desktop computer, and download it to your Newton (or post the finished package file on-line, if there is no copyright problem). I will describe the steps for a Mac and I will note the differences for Windows BookMaker, although I have not tried that program:

1. Install the PDFConvert program on a computer that supports Java 2.

   See steps 1 to 3 above for the setup instructions.
   (Hopefully, someone on NewtonTalk will set up a server running PDFConvert for us poor underprivilged MacOS9 users.)

2. Run the PDFConvert program. On my Windows NT machine, this would be:

   D:\PDFConv> run -pict "-source=myfile.PDF" "-basename=myfile"

   The -pict switch tells PDFConvert to generate PICT files for BookMaker.
   This switch must come before the file names on the command line.
   The "source=" is the name of your PDF.
   The "basename" will be used as the of your BookMaker source file,
   and the base name of the PICT files that it references.
   It will also be the .title and .isbn of your finished document.

   There are additional arguments to specify the size and location
   of your PICT images. See the readme for more information.

3. Transfer the .txt file and the .pict files from the output directory of your Java computer to your Mac (or to a different folder on your Mac, if you are running MacOS X.)

I recommend storing the files in a folder called PDFConvert, in the Documents folder, on your startup disk. The PDFConvert program assumes that the PICT files will be in a folder with this name. (Note that PDFConvert is spelled out in full. The program folder was PDFConv.)

Also copy the PDFConvert.mac file from your PDFConv directory on your PC or Unix computer to the PDFConvert folder in the Documents folder on your Mac. This file is the NTK project file for your book.

4. If you have not already done so, install NewtonDev on your Mac.

http://de.unna.org/unna/development/NewtonDev/NewtonDev.sit

This will install the Newton Book Maker and Newton Tool Kit that you need to build Newton Books. (It will also install Newton Press. Good luck).

Increase the memory allocation of BookMaker and NTK, since they are both too small for any reasonably sized book. I increased BookMaker to 28MB, and NTK to 32MB.

5. (Optional) If your hard disk is not named "Macintosh HD", or you did not create a PDFConvert folder in the Documents folder of your hard disk, then you need to edit the file names in your NewtonBook document.

Use BBEdit (or SimpleText) to open the text file that you generated in PDFConvert. In the example above, the file would be myfile.txt, and would be in the myPDF folder on your desktop. It will look something like this:

.title PDF
.isbn PDF:EMSI
.picture ":Macintosh HD:Documents:PDFConvert:myfile_page_1.pict"
.picture ":Macintosh HD:Documents:PDFConvert:myfile_page_2.pict"
.picture ":Macintosh HD:Documents:PDFConvert:myfile_page_3.pict"


Change each .picture line to include the full path to your .pict files.
In the example, I have changed the name of the hard disk.
Note the leading colon in the path:

.title PDF
.isbn PDF:EMSI
.picture ":Clara:Documents:myPDF:myfile_page_1.pict"
.picture ":Clara:Documents:myPDF:myfile_page_2.pict"
.picture ":Clara:Documents:myPDF:myfile_page_3.pict"

Save the BookMaker file and exit the editor.

(Note for PC Users: The Windows version of BookMaker does not support the feature of specifying the image [BMP?] file name on the .picture line. The actual images have to be placed in the document, on the line following the .picture command. You would need to use some word processor that supports embedded images and is readable by BookMaker. You would also have to convert the JPG or PICT images to BMP format)

6. Launch Newton Book Maker. It is located in the Newton Book Maker folder of the Book Tools folder of the NewtonDev folder on your hard disk.

7. Select File->Open, and open your myfile.txt document.

8. Press Do It. If there are any errors, fix the text file and try again. The most likely problem is mistyping the path to your pict files.

If all goes well, Book Maker will run for a few seconds, and then prompt you for a location to save the file. Give it the name PDFConvert.txt.f, and save it in your PDFConvert folder. (You need to call the file PDFConvert.txt.f, because that is the name that the NTK project file will be looking for. If you are competent in NTK, you can rename the file to whatever you like.)

9. Exit BookMaker

10. (Optional) Resize your PDF for the Newton 2x00 screen size:

Open the PDFConvert.txt.f file in BBEdit:

http://www.barebones.com/products/bblite/index.shtml

(You need to use BBEdit because the file is too large for SimpleText, and NTK will damage the resource fork of the file. If you get a "missing resource" error when you build your project, it is because you used the wrong editor. Re-run BookMaker and edit the file again)

We need to change the page size. Find the text that looks like this:

-----------------------------------------------------------------------
// Bounds List
bnd1 := [0,16,288,334];

// Pages
pageList := {pageSize: {left: 0, top: 0, right: 240, bottom: 318},
	contents: [], pages: []};
-----------------------------------------------------------------------


Change the bounds and pageSize. Note that the pagesize in your original file will always be 240 x 318, but the bounds list will vary based on your image size. In any case, change both of them to 320 x 432. 

-----------------------------------------------------------------------
// Bounds List
bnd1 := [0,16,320,432];

// Pages
pageList := {pageSize: {left: 0, top: 0, right: 320, bottom: 432},
	contents: [], pages: []};
-----------------------------------------------------------------------

Save the file and quit BBEdit.


11. Now we are ready to build our package. Launch NTK. It should be in the NTK 1.6.4 folder of your NewtonDev folder.

12. In NTK, select File->Open and choose PDFConvert.mac from your myPDF folder.

13. (Optional, but recommended) Change the name of your package.

Select Project->Project Settings, and go to the Output Settings and Package Settings panels. Change the text in both of these to mytext, or some short descriptive name.

14. Press Command-1 to build your book, and Command-2 to download it to your Newton.


That's it. You have converted a PDF to a Newton Book.


 change history:
version 0.1.3 February 14, 2003 

    * Added -pict to help text on command line,
      Changed program to generate BookMaker file when -pict is specified
      Changed HTML <title> section to reflect base file name
      Created this readme_also file




Eric Schneck
eschneck@mindspring.com

