void runtest(int n)
{
    QPDF pdf;
    pdf.emptyPDF();
    if (n == 0)
    {
        // Create a minimal PDF from scratch.

        QPDFObjectHandle font = pdf.makeIndirectObject(
            QPDFObjectHandle::parse("<<"
                                    " /Type /Font"
                                    " /Subtype /Type1"
                                    " /Name /F1"
                                    " /BaseFont /Helvetica"
                                    " /Encoding /WinAnsiEncoding"
                                    ">>"));

        QPDFObjectHandle procset = pdf.makeIndirectObject(
            QPDFObjectHandle::parse("[/PDF /Text]"));

        QPDFObjectHandle contents = createPageContents(pdf, "First Page");

        QPDFObjectHandle mediabox = QPDFObjectHandle::parse("[0 0 612 792]");

        QPDFObjectHandle rfont = QPDFObjectHandle::newDictionary();
        rfont.replaceKey("/F1", font);

        QPDFObjectHandle resources = QPDFObjectHandle::newDictionary();
        resources.replaceKey("/ProcSet", procset);
        resources.replaceKey("/Font", rfont);

        QPDFObjectHandle page = pdf.makeIndirectObject(
            QPDFObjectHandle::newDictionary());
        page.replaceKey("/Type", newName("/Page"));
        page.replaceKey("/MediaBox", mediabox);
        page.replaceKey("/Contents", contents);
        page.replaceKey("/Resources", resources);

        pdf.addPage(page, true);

	QPDFWriter w(pdf, "a.pdf");
	w.setStaticID(true);
	w.setStreamDataMode(qpdf_s_preserve);
	w.write();
    }
    else
    {
	throw std::runtime_error(std::string("invalid test ") +
				 QUtil::int_to_string(n));
    }

    std::cout << "test " << n << " done" << std::endl;
}
void runtest(int n)
{
    QPDF pdf;
    pdf.emptyPDF();
    if (n == 0)
    {
         

        QPDFObjectHandle font = pdf.makeIndirectObject(
            QPDFObjectHandle::parse("<<"
                                    " /Type /Font"
                                    " /Subtype /Type1"
                                    " /Name /F1"
                                    " /BaseFont /Helvetica"
                                    " /Encoding /WinAnsiEncoding"
                                    ">>"));

        QPDFObjectHandle procset = pdf.makeIndirectObject(
            QPDFObjectHandle::parse("[/PDF /Text]"));

        QPDFObjectHandle contents = createPageContents(pdf, "First Page");

        QPDFObjectHandle mediabox = QPDFObjectHandle::parse("[0 0 612 792]");

        QPDFObjectHandle rfont = QPDFObjectHandle::newDictionary();
        rfont.replaceKey("/F1", font);

        QPDFObjectHandle resources = QPDFObjectHandle::newDictionary();
        resources.replaceKey("/ProcSet", procset);
        resources.replaceKey("/Font", rfont);

        QPDFObjectHandle page = pdf.makeIndirectObject(
            QPDFObjectHandle::newDictionary());
        page.replaceKey("/Type", newName("/Page"));
        page.replaceKey("/MediaBox", mediabox);
        page.replaceKey("/Contents", contents);
        page.replaceKey("/Resources", resources);

        pdf.addPage(page, true);

	QPDFWriter w(pdf, "a.pdf");
	w.setStaticID(true);
	w.setStreamDataMode(qpdf_s_preserve);
	w.write();
    }
    else
    {
	throw std::runtime_error(std::string("invalid test ") +
				 QUtil::int_to_string(n));
    }

    std::cout << "test " << n << " done" << std::endl;
}