$tr3d->PushBackNumber(-1); $tr3d->PushBackNumber(0); $tr3d->PushBackNumber(1); $tr3d->PushBackNumber(0); $tr3d->PushBackNumber(0); $tr3d->PushBackNumber(-27.5); $tr3d->PushBackNumber(0); // Create annotation appearance stream, a thumbnail which is used during printing or // in PDF processors that do not understand 3D data. $ap_dict = $link_3D->PutDict("AP"); $builder = new ElementBuilder(); $writer = new ElementWriter(); $writer->Begin($doc->GetSDFDoc()); $thumb_pathname = $input_path . "dice.jpg"; $image = Image::Create($doc->GetSDFDoc(), $thumb_pathname); $writer->WritePlacedElement($builder->CreateImage($image, 0.0, 0.0, $link_3D_rect->Width(), $link_3D_rect->Height())); $normal_ap_stream = $writer->End(); $normal_ap_stream->PutName("Subtype", "Form"); $normal_ap_stream->PutRect("BBox", 0, 0, $link_3D_rect->Width(), $link_3D_rect->Height()); $ap_dict->Put("N", $normal_ap_stream); } // --------------------------------------------------------------------------------- PDFNet::Initialize(); $doc = new PDFDoc(); $page = $doc->PageCreate(); $doc->PagePushBack($page); $annots = $doc->CreateIndirectArray(); $page->GetSDFObj()->Put("Annots", $annots); Create3DAnnotation($doc, $annots); $doc->Save($output_path . "dice_u3d.pdf", SDFDoc::e_linearized); echo "Done.\n";