コード例 #1
0
$element = $builder->CreateTextRun("A");
$element->SetPosAdjustment(140);
$writer->WriteElement($element);
$element = $builder->CreateTextRun("Y again");
$element->SetPosAdjustment(115);
$writer->WriteElement($element);
// Draw the same strings using direct content output...
$writer->Flush();
// flush pending Element writing operations.
// You can also write page content directly to the content stream using
// ElementWriter.WriteString(...) and ElementWriter.WriteBuffer(...) methods.
// Note that if you are planning to use these functions you need to be familiar
// with PDF page content operators (see Appendix A in PDF Reference Manual).
// Because it is easy to make mistakes during direct output we recommend that
// you use ElementBuilder and Element interface instead.
$writer->WriteString("T* T* ");
// Skip 2 lines
$writer->WriteString("(Direct output to PDF page content stream:) Tj  T* ");
$writer->WriteString("(AWAY) Tj T* ");
$writer->WriteString("[(A)140(W)140(A)115(Y again)] TJ ");
// Finish the block of text
$writer->WriteElement($builder->CreateTextEnd());
$writer->End();
// save changes to the current page
$doc->PagePushBack($page);
// Start a new page ------------------------------------
// Image Masks
//
// In the opaque imaging model, images mark all areas they occupy on the page as
// if with opaque paint. All portions of the image, whether black, white, gray,
// or color, completely obscure any marks that may previously have existed in the