Skip to content

API 매핑 테이블

이 페이지는 일반적으로 사용되는 모든 TCPDF 메서드와 그에 대응하는 TCPDF-Next 동등 기능의 포괄적인 매핑을 제공합니다. 기존 코드를 마이그레이션할 때 레퍼런스로 사용하세요.

문서 설정

레거시 TCPDFTCPDF-Next비고
new TCPDF($orientation, $unit, $format)PdfDocument::create()->setOrientation(...)->setPageFormat(...)->build()명명된 파라미터, 플루언트 빌더
SetCreator($creator)->setCreator($creator)
SetAuthor($author)->setAuthor($author)
SetTitle($title)->setTitle($title)
SetSubject($subject)->setSubject($subject)
SetKeywords($keywords)->setKeywords([...])쉼표 구분 문자열 대신 배열
SetMargins($left, $top, $right)->setMargins(new Margins($left, $right, $top, $bottom))값 객체
SetCellMargins($l, $t, $r, $b)TextBlock::create()->setPadding(...)요소별 패딩
SetAutoPageBreak($auto, $margin)->setAutoPageBreak($auto, bottomMargin: $margin)명명된 파라미터
setLanguageArray($lang)->setLocale($locale)표준 로케일 문자열
setFontSubsetting($enable)->getFontManager()->setSubsetting($enable)
SetDefaultMonospacedFont($font)$renderer->setDefaultMonoFont($font)
SetDisplayMode($zoom, $layout)->setViewerPreferences(zoom: $zoom, layout: $layout)
setImageScale($scale)불필요DPI 기반 크기 조정
SetHeaderMargin($margin)->setMargins(new Margins(..., header: $margin))
SetFooterMargin($margin)->setMargins(new Margins(..., footer: $margin))
setPrintHeader($enable)onPageHeader() 콜백 생략
setPrintFooter($enable)onPageFooter() 콜백 생략

페이지 관리

레거시 TCPDFTCPDF-Next비고
AddPage($orientation, $format)$pdf->addPage($format, $orientation)
endPage()자동다음 addPage()에서 암시적
getPage()$pdf->getCurrentPageNumber()
setPage($page)$pdf->getPage($pageNumber)
getNumPages()$pdf->getPageCount()
deletePage($page)$pdf->removePage($pageNumber)
movePage($from, $to)$pdf->movePage($from, $to)
copyPage($page)$pdf->duplicatePage($pageNumber)
lastPage()$pdf->getPage($pdf->getPageCount())
getPageWidth()$page->getWidth()
getPageHeight()$page->getHeight()
SetXY($x, $y)->setPosition($x, $y)요소별 위치 지정
GetX() / GetY()$page->getCursorX() / $page->getCursorY()
SetX($x) / SetY($y)$page->setCursor($x, $y)
getBreakMargin()$page->getBottomMargin()

폰트 작업

레거시 TCPDFTCPDF-Next비고
SetFont($family, $style, $size)$page->setFont($family, size: $size, style: FontStyle::BOLD)스타일에 Enum
SetFontSize($size)$page->setFont(..., size: $size)
addTTFfont($fontfile)$pdf->getFontManager()->registerFont($path, $name)표준 TTF/OTF
getFontFamilyName()$page->getCurrentFont()->getFamily()
getFontSize()$page->getCurrentFont()->getSize()
getFontSizePt()$page->getCurrentFont()->getSizeInPoints()
isCharDefined($char)$font->hasGlyph($char)
GetStringWidth($string)$font->measureText($string, $size)->getWidth()
GetCharWidth($char)$font->getGlyphWidth($char, $size)
getNumLines($text, $width)$font->calculateLines($text, $width, $size)

텍스트 출력

레거시 TCPDFTCPDF-Next비고
Cell($w, $h, $txt, $border, $ln, $align)$page->addText($txt)->setSize($w, $h)->setAlignment(...)플루언트 API
MultiCell($w, $h, $txt, $border, $align)$page->addParagraph($txt)->setWidth($w)->setAlignment(...)
Write($h, $txt, $link)$page->addText($txt)->setLineHeight($h)->setLink($link)
writeHTML($html)$renderer->writeHtml($html)DOM 기반 파서
writeHTMLCell($w, $h, $x, $y, $html)$renderer->writeHtml($html, position: [$x, $y], width: $w)
Text($x, $y, $txt)$page->addText($txt)->setPosition($x, $y)
Ln($h)$page->advanceCursor($h)
SetTextColor($r, $g, $b)->setColor(Color::rgb($r, $g, $b))값 객체
SetTextColorArray($color)->setColor(Color::fromArray($color))

이미지

레거시 TCPDFTCPDF-Next비고
Image($file, $x, $y, $w, $h, $type)$page->addImage($file)->setPosition($x,$y)->setSize($w,$h)포맷 자동 감지
ImageEps($file, $x, $y, $w, $h)$page->addImage($file)->setPosition($x,$y)->setSize($w,$h)통합 API
ImageSVG($file, $x, $y, $w, $h)$page->addImage($file)->setPosition($x,$y)->setSize($w,$h)통합 API
setImageBuffer($image, $data)$page->addImage($binaryData, format: $fmt)
setJPEGQuality($quality)ImagePolicy::create()->setJpegQuality($quality)

드로잉 및 그래픽

레거시 TCPDFTCPDF-Next비고
Line($x1, $y1, $x2, $y2)$canvas->drawLine($x1, $y1, $x2, $y2)->stroke()
Rect($x, $y, $w, $h, $style)$canvas->drawRect($x, $y, $w, $h)->fill() 또는 ->stroke()
RoundedRect($x, $y, $w, $h, $r)$canvas->drawRoundedRect($x, $y, $w, $h, $r)
Circle($x, $y, $r)$canvas->drawCircle($x, $y, $r)
Ellipse($x, $y, $rx, $ry)$canvas->drawEllipse($x, $y, $rx, $ry)
Curve($x0,$y0,$x1,$y1,$x2,$y2,$x3,$y3)$canvas->moveTo($x0,$y0)->curveTo($x1,$y1,$x2,$y2,$x3,$y3)
Polygon($points)$canvas->drawPolygon($points)
RegularPolygon($x, $y, $r, $sides)$canvas->drawRegularPolygon($x, $y, $r, $sides)
Arrow($x0, $y0, $x1, $y1)$canvas->drawArrow($x0, $y0, $x1, $y1)
SetDrawColor($r, $g, $b)$canvas->setStrokeColor(Color::rgb($r, $g, $b))
SetFillColor($r, $g, $b)$canvas->setFillColor(Color::rgb($r, $g, $b))
SetDrawColorArray($color)$canvas->setStrokeColor(Color::fromArray($color))
SetFillColorArray($color)$canvas->setFillColor(Color::fromArray($color))
SetLineWidth($width)$canvas->setLineWidth($width)
SetLineStyle($style)$canvas->setLineStyle(LineStyle::from($style))
SetAlpha($alpha, $blend)$canvas->setOpacity($alpha)->setBlendMode($blend)

변환

레거시 TCPDFTCPDF-Next비고
StartTransform()$canvas->saveState()
StopTransform()$canvas->restoreState()
Translate($tx, $ty)$canvas->translate($tx, $ty)
Rotate($angle, $x, $y)$canvas->rotate($angle, $x, $y)
Scale($sx, $sy, $x, $y)$canvas->scale($sx, $sy, $x, $y)
MirrorH($x)$canvas->scale(-1, 1, $x, 0)
MirrorV($y)$canvas->scale(1, -1, 0, $y)
Skew($xAngle, $yAngle)$canvas->skew($xAngle, $yAngle)

링크 및 북마크

레거시 TCPDFTCPDF-Next비고
SetLink($link, $y, $page)$pdf->createInternalLink($page, $y)
AddLink()$pdf->createLink()
Link($x, $y, $w, $h, $link)$page->addLink($url)->setRect($x, $y, $w, $h)
Annotation($x, $y, $w, $h, $text)$page->addAnnotation($text)->setRect($x, $y, $w, $h)
Bookmark($txt, $level)$pdf->addBookmark($txt, level: $level)

바코드

레거시 TCPDFTCPDF-Next비고
write1DBarcode($code, $type, ...)$page->addBarcode(BarcodeFactory::$type($code))->setPosition(...)타입 안전 팩토리
write2DBarcode($code, 'QRCODE', ...)$page->addBarcode(BarcodeFactory::qrCode($code))->setPosition(...)
write2DBarcode($code, 'DATAMATRIX', ...)$page->addBarcode(BarcodeFactory::dataMatrix($code))->setPosition(...)
write2DBarcode($code, 'PDF417', ...)$page->addBarcode(BarcodeFactory::pdf417($code))->setPosition(...)

암호화 및 보안

레거시 TCPDFTCPDF-Next비고
SetProtection($perms, $uPass, $oPass, $mode)$pdf->setEncryption()->setPermissions(...)->apply()AES-256만
setSignature($cert, $key, $pass, $extra)$signer = new PdfSigner($pdf); $signer->setCertificate(...)전체 PAdES 지원
setSignatureAppearance($x, $y, $w, $h)$signer->setSignatureField(new SignatureField(...))

TIP

TCPDF의 setSignature()는 기본 PKCS#7 서명만 생성합니다. TCPDF-Next는 타임스탬프 통합, OCSP 임베딩, 문서 보안 저장소를 포함한 전체 PAdES B-B부터 B-LTA를 지원합니다. PAdES B-LTA를 참조하세요.

출력

레거시 TCPDFTCPDF-Next비고
Output($name, 'F')$pdf->save($path)파일에 저장
Output($name, 'D')Content-Disposition: attachment를 포함한 프레임워크 응답
Output($name, 'I')Content-Disposition: inline을 포함한 프레임워크 응답
Output($name, 'S')$pdf->toString()바이너리 문자열로 반환
Output($name, 'FI')$pdf->save($path) + 인라인 응답
Output($name, 'FD')$pdf->save($path) + 다운로드 응답
Output($name, 'E')base64_encode($pdf->toString())

PDF/A 및 메타데이터

레거시 TCPDFTCPDF-Next비고
setPDFVersion($version)항상 PDF 2.0구성 불가
사용 불가->setPdfALevel(PdfALevel::PDF_A_4)새로운 기능
사용 불가->setPdfALevel(PdfALevel::PDF_A_4F)새로운 기능
setExtraXMP($xmp)$pdf->getMetadata()->setXmpProperty(...)

직접 대응이 없는 메서드

이 레거시 TCPDF 메서드들은 TCPDF-Next에서 다르게 처리됩니다:

레거시 TCPDF비고
setRTL($enable)유니코드 BiDi 알고리즘(UAX #9)을 통해 자동
setTempPath($path)PdfDocument::create()->setTempDir(...)
setCellHeightRatio($ratio)텍스트 블록에서 명시적 줄 높이 사용
setListIndentWidth($width)목록의 CSS padding-left
setOpenCell($isopen)해당 없음 (다른 셀 모델)
getHTMLUnitToUnits()해당 없음 (자동 단위 변환)
pixelsToUnits($px)Units::pixelsToMm($px, $dpi)
unhtmlentities($text)htmlspecialchars_decode() (PHP 내장)

더 읽을거리

LGPL-3.0-or-later 라이선스로 배포됩니다.