Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special font (⸧) error using writeHtml write error: Undefined array key 11815 #728

Open
LiuShuaiaCai opened this issue Jun 20, 2024 · 1 comment

Comments

@LiuShuaiaCai
Copy link

LiuShuaiaCai commented Jun 20, 2024

Use some special characters:
$specialChars="①, √, ≤, ≥, x, ⸷, δ, ∑, ⇌, ①, ②, ③, Å,~, ⊃, ➀, ➁, ➂, ≃, ϶, ś, ś, ⊂, ⧫, ɛ, −, •,", ↔, ő,Đ,ć,Ž,ń,ğ,ę,ż,ϒ, á, ó, š, Å, ñ, ó, ź, é, í, ú, à, è, ì, ò, ù, ê, ↕, I, II, III, IV, V, VI, VII, VIII, IX, Á, í, ó, €, Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ, Λ, Μ,Ν,Ξ,Ο,Π,Ρ,Σ,Τ,Υ,Φ,Χ,Ψ, Ω, α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ,ν,ξ,ο, π, ρ,ς,σ,τ,υ,φ,χ,ψ,ω, , ϵ,∞,سوریف,نورک,دیفوک,انوروک, ṁ, ṁ, ṁ, ü, ß, ß, ṁ, ṁ, ◻,ɛ,ɔ,‧, ●, ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ", ց,ē,ū,④,⑤,⑥,ƛ,ň, č, ⇄, ⸧, Å, I, Ẑ, □, ⁝, ⋱, ⧧, ѵ, ‴, Å, ⸧, Å, I, Ẑ, □, ⁝, ⋱, ⧧, ѵ, ‴, Å, ɳ, △, æ, ℃, Å, ◆, ☆, ∈, ∝, Λ, ⁋, ();
TCPDF version 6.7.5 error message:
Undefined array key 11815
error_file:vendor\tecnickcom\tcpdf\include\tcpdf_fonts.php

image

@LiuShuaiaCai
Copy link
Author

// 创建新的 PDF 文档
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// 设置文档信息
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Author');
$pdf->SetTitle('Title');
$pdf->SetSubject('Subject');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

// 设置默认字体子集
$pdf->setFontSubsetting(true);

// 设置字体 - 使用 DejaVu Sans
$pdf->SetFont('dejavusans', '', 12);

// 添加页面
$pdf->AddPage();

// 特殊字符字符串
$specialChars = "①,√,≤,≥,×,√,δ,∑,⇌,①,②,③,Å,~,⊃,➀,➁,➂,≃,∪,϶,∇,ś,≫,⇔,⊂,⧫,ɛ,−,•,↔,ő,Đ,ć,Ž,ń,ğ,ę,ż,ϒ,ć,á,ó,š,å,ñ,ó,ź,é,í,ú,à,è,ì,ò,ù,ê,â,ê,î,↨,С,О,Х,↕,Ⅰ,Ⅱ,Ⅲ,Ⅳ,Ⅴ,Ⅵ,Ⅶ,Ⅷ,Ⅸ,Á,í,ó,€,Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ,Λ,Μ,Ν,Ξ,Ο,Π,Ρ,Σ,Τ,Υ,Φ,Χ,Ψ,Ω,α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ,ν,ξ,ο,π,ρ,ς,σ,τ,υ,φ,χ,ψ,ω,ª,±,→,↑,↓,←,■,¢,≡,ŷ,′,″,⅓,⅔,≠,○,ş,‖,č,Å,ñ,≈,₂,ϕ,ϋ,ʎ,á,é,ϵ,∞,سوریف,نورک,دیفوک,انوروک,ṁ,İ,ü,Г,ü,ß,◊,◻,ɛ,ɔ,‧,●,《,》,Č,ř,Ʃ,▲,▼,–,ф,ћ,ƞ,∩,∠,❈,ǀ,µ,⊃,Í,Ú,Ф,ḉ,Ω,Ʌ,ℑ,ց,ē,ū,④,①,②,③,⑤,⑥,ƛ,ň,č,⇄,⇌,⸧,Å,и,Ẑ,□,⁝,⋱,⧧,ѵ,‴,⌀,┴,ɳ,△,⊥,℃,ā,◆,☆,∈,∝,∧,⁋,mmm,(";

    $htmlEntities = mb_convert_encoding($specialChars, 'HTML-ENTITIES', 'UTF-8');

// 包含 HTML 标记以应用字体
$html = '' . $htmlEntities . '';

// 写入 HTML 内容
$pdf->writeHTML($html, true, false, true, false, '');
// 关闭并输出 PDF 文档
$pdfLocalPath = storage_path('a.pdf');
$pdf->Output($pdfLocalPath, 'F');

@LiuShuaiaCai LiuShuaiaCai changed the title Special font (⸷) error using writeHtml write error: Undefined array key 11815 Special font (⸧) error using writeHtml write error: Undefined array key 11815 Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant