writeLine(mPDFGeometryWriter, "1 0 0 1 " + (-heightInPoints) + " 0 cm");
writeLine(mPDFGeometryWriter, "1 0 0 1 0 " + (-heightInPoints) + " cm");
	private void writePDFHeader(double width, double height,		int resolution, boolean turnPage, ArrayList fontList, Color backgroundColor)		throws IOException, MapyrusException	{		long widthInPoints = Math.round(width / Constants.MM_PER_INCH *	Constants.POINTS_PER_INCH);		long heightInPoints = Math.round(height / Constants.MM_PER_INCH * Constants.POINTS_PER_INCH);		mPDFFileOffsets = new ArrayList();		int nChars = writeLine(mWriter, "%PDF-1.4");		mPDFFileOffsets.add(new Integer(nChars));		nChars += writeLine(mWriter, "1 0 obj");		nChars += writeLine(mWriter, "<<");		nChars += writeLine(mWriter, "/Type /Catalog");		nChars += writeLine(mWriter, "/Outlines 2 0 R");		nChars += writeLine(mWriter, "/Pages 3 0 R");		nChars += writeLine(mWriter, ">>");		nChars += writeLine(mWriter, "endobj");		mPDFFileOffsets.add(new Integer(nChars));		nChars += writeLine(mWriter, "2 0 obj");		nChars += writeLine(mWriter, "<<");		nChars += writeLine(mWriter, "/Type /Outlines");		nChars += writeLine(mWriter, "/Count 0");		nChars += writeLine(mWriter, ">>");		nChars += writeLine(mWriter, "endobj");		mWriter.flush();		mPDFFileOffsets.add(new Integer(nChars));		nChars += writeLine(mWriter, "3 0 obj");		nChars += writeLine(mWriter, "<<");		nChars += writeLine(mWriter, "/Type /Pages");		nChars += writeLine(mWriter, "/Kids [4 0 R]");		nChars += writeLine(mWriter, "/Count 1");		nChars += writeLine(mWriter, ">>");		nChars += writeLine(mWriter, "endobj");		mPDFFileOffsets.add(new Integer(nChars));		nChars += writeLine(mWriter, "4 0 obj");		nChars += writeLine(mWriter, "<<");		nChars += writeLine(mWriter, "/Type /Page");		nChars += writeLine(mWriter, "/MediaBox [0 0 " + widthInPoints + " " + heightInPoints + "]");		nChars += writeLine(mWriter, "/Contents 5 0 R");		nChars += writeLine(mWriter, "/Resources 6 0 R");		nChars += writeLine(mWriter, ">>");		nChars += writeLine(mWriter, "endobj");		mPDFFileOffsets.add(new Integer(nChars));		mPDFImageObjects = new ArrayList();		mPDFGeometryStringWriter = new StringWriter();		mPDFGeometryWriter = new PrintWriter(mPDFGeometryStringWriter);		if (turnPage)		{			/*			 * Turn page 90 degrees so that a landscape orientation page appears			 * on a portrait page.			 */			writeLine(mPDFGeometryWriter, "0 1 -1 0 0 0 cm");			writeLine(mPDFGeometryWriter, "1 0 0 1 " + (-heightInPoints) + " 0 cm");		}		if (backgroundColor != null)		{			/*			 * Write object to set page background.			 */			float components[] = backgroundColor.getColorComponents(null);			writeLine(mPDFGeometryWriter, "q");			writeLine(mPDFGeometryWriter, "0 0 " + widthInPoints + " " + heightInPoints + " re");			for (int i = 0; i < components.length; i++)				writeLine(mPDFGeometryWriter, mCoordinateDecimal.format(components[i]));			writeLine(mPDFGeometryWriter, "rg f Q");		}		/*		 * Set scale so that we can give all coordinate positions in millimetres.		 */		double scale = Constants.POINTS_PER_INCH / Constants.MM_PER_INCH;		writeLine(mPDFGeometryWriter, scale + " 0 0 " + scale + " 0 0 cm");	}