Beispiel #1
0
function generate_pdf($url)
{
    $js = generate_js($url);
    $js = pdf_FlateEncode($js);
    $jslen = strlen($js);
    $swf = pdf_FlateEncode(generate_swf());
    $swflen = strlen($swf);
    $swfname = 'test.swf';
    $eol = '
';
    $endobj = 'endobj' . $eol;
    $xref = array();
    $pdf = '%PDF-1.5' . $eol;
    $pdf = $pdf . '%' . RandomNonASCIIString(4) . $eol;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(1) . '<</Type/Catalog';
    $pdf = $pdf . '/Pages ' . ioRef(3);
    $pdf = $pdf . '/OpenAction ' . ioRef(5);
    $pdf = $pdf . '/AcroForm ' . ioRef(17);
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(3) . '<</Type/Pages/Count 1/Kids [' . ioRef(4) . ']>>' . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(4) . '<</Type/Page/Parent ' . ioRef(3);
    $pdf = $pdf . '/Annots [' . ioRef(7) . '] ';
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(5) . '<</Type/Action/S/JavaScript/JS ' . ioRef(6) . '>>' . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(6) . '<</Length ' . $jslen . '/Filter[/FlateDecode]>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $js . $eol;
    $pdf = $pdf . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(7) . '<</Type/Annot/Subtype/RichMedia';
    $pdf = $pdf . '/Rect [20 20 187 69] ';
    $pdf = $pdf . '/RichMediaSettings ' . ioRef(8);
    $pdf = $pdf . '/RichMediaContent ' . ioRef(9);
    $pdf = $pdf . '/NM (' . $swfname . ')';
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(8);
    $pdf = $pdf . '<</Type/RichMediaSettings/Subtype/Flash';
    $pdf = $pdf . '/Activation ' . ioRef(10);
    $pdf = $pdf . '/Deactivation ' . ioRef(11);
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(9);
    $pdf = $pdf . '<</Type/RichMediaContent';
    $pdf = $pdf . '/Assets ' . ioRef(12);
    $pdf = $pdf . '/Configurations [' . ioRef(14) . ']';
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(10);
    $pdf = $pdf . '<</Type/RichMediaActivation/Condition/PO>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(11);
    $pdf = $pdf . '<</Type/RichMediaDeactivation/Condition/XD>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(12);
    $pdf = $pdf . '<</Names [(' . $swfname . ') ' . ioRef(13) . ']>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(13);
    $pdf = $pdf . '<</Type/Filespec /EF <</F ' . ioRef(16) . '>> /F(' . $swfname . ')>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(14);
    $pdf = $pdf . '<</Type/RichMediaConfiguration/Subtype/Flash';
    $pdf = $pdf . '/Instances [' . ioRef(15) . ']>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(15);
    $pdf = $pdf . '<</Type/RichMediaInstance/Subtype/Flash';
    $pdf = $pdf . '/Asset ' . ioRef(13);
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(16) . '<</Type/EmbeddedFile/Length ' . $swflen . '/Filter[/FlateDecode]>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $swf . $eol;
    $pdf = $pdf . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(17);
    $pdf = $pdf . '<</XFA ' . ioRef(18) . '>>' . $eol;
    $pdf = $pdf . $endobj;
    $xfa = '<?xml version="1.0" encoding="UTF-8"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
<config xmlns="http://www.xfa.org/schema/xci/2.6/">
<present><pdf><interactive>1</interactive></pdf></present>
</config>
<template xmlns="http://www.xfa.org/schema/xfa-template/2.6/">
<subform name="form1" layout="tb" locale="en_US">
<pageSet></pageSet>
</subform></template></xdp:xdp>';
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(18) . '<</Length ' . strlen($xfa) . '>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $xfa . $eol;
    $pdf = $pdf . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xrefPosition = strlen($pdf);
    $pdf = $pdf . 'xref' . $eol;
    $pdf = $pdf . '0 ' . (count($xref) + 1) . $eol;
    $pdf = $pdf . '0000000000 65535 f' . $eol;
    $i = 0;
    while ($i < count($xref)) {
        $temp = sprintf('%010d 00000 n', $xref[$i]);
        $pdf = $pdf . $temp . $eol;
        ++$i;
    }
    $pdf = $pdf . 'trailer' . $eol;
    $pdf = $pdf . '<</Size ' . (count($xref) + 1) . '/Root ' . ioRef(1) . '>>' . $eol;
    $pdf = $pdf . 'startxref' . $eol;
    $pdf = $pdf . $xrefPosition . $eol;
    $pdf = $pdf . '%%EOF' . $eol;
    return $pdf;
}
function generate_pdf($url)
{
    $xml = pdf_FlateEncode(generate_xml($url));
    $xmllen = strlen($xml);
    $eol = '
';
    $endobj = 'endobj' . $eol;
    $xref = array();
    $pdf = '%PDF-1.5' . $eol;
    $pdf = $pdf . '%' . RandomNonASCIIString(4) . $eol;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(1) . '<</Length ' . strlen($xml) . '/Filter [/FlateDecode]/Type /EmbeddedFile>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $xml . $eol;
    $pdf = $pdf . $eol . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(2) . '<</V () /Kids [' . ioRef(3) . '] /T (' . 'Top[0]' . ') >>' . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(3) . '<</Parent ' . ioRef(2) . ' /Kids [' . ioRef(4) . '] /T (Page1[0])>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(4) . '<</MK <</IF <</A [0.0 1.0]>>/TP 1>>/P ' . ioRef(5);
    $pdf = $pdf . '/FT /Btn/TU (' . 'Image' . ')/Ff 65536/Parent ' . ioRef(3);
    $pdf = $pdf . '/F 4/DA (/CourierStd 10 Tf 0 g)/Subtype /Widget/Type /Annot/T (' . 'Image[0]' . ')/Rect [107.385 705.147 188.385 709.087]>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(5) . '<</Rotate 0 /CropBox [0.0 0.0 612.0 792.0]/MediaBox [0.0 0.0 612.0 792.0]/Resources <</XObject >>/Parent ';
    $pdf = $pdf . ioRef(6) . '/Type /Page/PieceInfo null>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(6) . '<</Kids [' . ioRef(5) . ']/Type /Pages/Count 1>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(7) . '<</PageMode /UseAttachments/Pages ' . ioRef(6);
    $pdf = $pdf . '/MarkInfo <</Marked true>>/Lang (en-us)/AcroForm ' . ioRef(8);
    $pdf = $pdf . '/Type /Catalog>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(8) . '<</DA (/Helv 0 Tf 0 g )/XFA [(template) ' . ioRef(1) . ']/Fields [';
    $pdf = $pdf . ioRef(2) . ']>>';
    $pdf = $pdf . $endobj . $eol;
    $xrefPosition = strlen($pdf);
    $pdf = $pdf . 'xref' . $eol;
    $pdf = $pdf . '0 ' . (count($xref) + 1) . $eol;
    $pdf = $pdf . '0000000000 65535 f' . $eol;
    $i = 0;
    while ($i < count($xref)) {
        $temp = sprintf('%010d 00000 n', $xref[$i]);
        $pdf = $pdf . $temp . $eol;
        ++$i;
    }
    $pdf = $pdf . 'trailer' . '<</Size ' . (count($xref) + 1) . '/Root ' . ioRef(7) . '>>' . $eol;
    $pdf = $pdf . 'startxref' . $eol;
    $pdf = $pdf . $xrefPosition . $eol;
    $pdf = $pdf . '%%EOF';
    return $pdf;
}
Beispiel #3
0
function generate_pdf($url)
{
    $js = generate_js($url);
    $js = pdf_FlateEncode($js);
    $jslen = strlen($js);
    $swf = generate_swf();
    $swf = pdf_ASCIIHexEncode($swf);
    $swflen = strlen($swf);
    $swfname = '20102884.swf';
    $eol = '
';
    $endobj = 'endobj' . $eol;
    $xref = array();
    $pdf = '%PDF-1.5' . $eol;
    $pdf = $pdf . '%' . RandomNonASCIIString(4) . $eol;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(1) . '<</Type/Catalog';
    $pdf = $pdf . '/Pages ' . ioRef(3);
    $pdf = $pdf . '/OpenAction ' . ioRef(5);
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(3) . '<</Type/Pages/Count 1/Kids [' . ioRef(4) . ']>>' . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(4) . '<</Type/Page/Parent ' . ioRef(3);
    $pdf = $pdf . '/Annots [' . ioRef(7) . '] ';
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(5) . '<</Type/Action/S/JavaScript/JS ' . ioRef(6) . '>>' . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(6) . '<</Length ' . $jslen . '/Filter[/FlateDecode]>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $js . $eol;
    $pdf = $pdf . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(7) . '<</Type/Annot/Subtype/RichMedia';
    $pdf = $pdf . '/Rect [20 20 187 69] ';
    $pdf = $pdf . '/RichMediaSettings ' . ioRef(8);
    $pdf = $pdf . '/RichMediaContent ' . ioRef(9);
    $pdf = $pdf . '/NM (' . $swfname . ')';
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(8);
    $pdf = $pdf . '<</Type/RichMediaSettings/Subtype/Flash';
    $pdf = $pdf . '/Activation ' . ioRef(10);
    $pdf = $pdf . '/Deactivation ' . ioRef(11);
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(9);
    $pdf = $pdf . '<</Type/RichMediaContent';
    $pdf = $pdf . '/Assets ' . ioRef(12);
    $pdf = $pdf . '/Configurations [' . ioRef(14) . ']';
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(10);
    $pdf = $pdf . '<</Type/RichMediaActivation/Condition/PO>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(11);
    $pdf = $pdf . '<</Type/RichMediaDeactivation/Condition/XD>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(12);
    $pdf = $pdf . '<</Names [(' . $swfname . ') ' . ioRef(13) . ']>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(13);
    $pdf = $pdf . '<</Type/Filespec /EF <</F ' . ioRef(16) . '>> /F(' . $swfname . ')>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(14);
    $pdf = $pdf . '<</Type/RichMediaConfiguration/Subtype/Flash';
    $pdf = $pdf . '/Instances [' . ioRef(15) . ']>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(15);
    $pdf = $pdf . '<</Type/RichMediaInstance/Subtype/Flash';
    $pdf = $pdf . '/Asset ' . ioRef(13);
    $pdf = $pdf . '>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(16) . '<</Type/EmbeddedFile/Length ' . $swflen . '/Filter[/ASCIIHexDecode]>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $swf . $eol;
    $pdf = $pdf . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xrefPosition = strlen($pdf);
    $pdf = $pdf . 'xref' . $eol;
    $pdf = $pdf . '0 ' . (count($xref) + 1) . $eol;
    $pdf = $pdf . '0000000000 65535 f' . $eol;
    $i = 0;
    while ($i < count($xref)) {
        $temp = sprintf('%010d 00000 n', $xref[$i]);
        $pdf = $pdf . $temp . $eol;
        ++$i;
    }
    $pdf = $pdf . 'trailer' . $eol;
    $pdf = $pdf . '<</Size ' . (count($xref) + 1) . '/Root ' . ioRef(1) . '>>' . $eol;
    $pdf = $pdf . 'startxref' . $eol;
    $pdf = $pdf . $xrefPosition . $eol;
    $pdf = $pdf . '%%EOF' . $eol;
    return $pdf;
}