Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][FPDF] Biały kwadrat w tekście
Bajaczysko
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 28.01.2015

Ostrzeżenie: (0%)
-----


Witam,
Tworzę PDF'a dynamicznie i mam problem z tą linijką:
Kod
$this->WriteHTML(iconv("UTF-8","ISO-8859-2", $_POST['jezyk']));

WriteHTML to funkcja, która zamiast <b>blabla</b> wypisze blabla.
Mój problem polega na tym, że zawsze początek tekstu wygląda tak:
(IMG:http://i.imgur.com/5sHaEor.png)
Znajduje się biały kwadracik z przodu. Dlaczego on tutaj jest i jak go usunąć?

Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Bajaczysko
post
Post #2





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 28.01.2015

Ostrzeżenie: (0%)
-----


nl2br() nie działa.
Przekonwertowałem pdf'a na kod 16 ale pokazały mi się same znaczki i nie wiem co zrobić - pierwszy raz takie coś zrobiłem. Jak znaleźć interesującą mnie linijkę tekstu w hexEdytorze?
WriteHTML wygląda w ten sposób (znajduje się to w klasie wraz z moimi innymi funkcjami):
  1. var $B=0;
  2. var $I=0;
  3. var $U=0;
  4. var $HREF='';
  5. var $ALIGN='';
  6.  
  7. function WriteHTML($html)
  8. {
  9. //HTML parser
  10. $html=str_replace("\n",' ',$html);
  11. $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
  12. foreach($a as $i=>$e)
  13. {
  14. if($i%2==0)
  15. {
  16. //Text
  17. if($this->HREF)
  18. $this->PutLink($this->HREF,$e);
  19. elseif($this->ALIGN=='center')
  20. $this->Cell(0,5,$e,0,1,'C');
  21. else
  22. $this->Write(5,$e);
  23. }
  24. else
  25. {
  26. //Tag
  27. if($e[0]=='/')
  28. $this->CloseTag(strtoupper(substr($e,1)));
  29. else
  30. {
  31. //Extract properties
  32. $a2=explode(' ',$e);
  33. $tag=strtoupper(array_shift($a2));
  34. $prop=array();
  35. foreach($a2 as $v)
  36. {
  37. if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
  38. $prop[strtoupper($a3[1])]=$a3[2];
  39. }
  40. $this->OpenTag($tag,$prop);
  41. }
  42. }
  43. }
  44. }
  45.  
  46. function OpenTag($tag,$prop)
  47. {
  48. //Opening tag
  49. if($tag=='B' || $tag=='I' || $tag=='U')
  50. $this->SetStyle($tag,true);
  51. if($tag=='A')
  52. $this->HREF=$prop['HREF'];
  53. if($tag=='BR')
  54. $this->Ln(5);
  55. if($tag=='P')
  56. $this->ALIGN=$prop['ALIGN'];
  57. if($tag=='HR')
  58. {
  59. if( !empty($prop['WIDTH']) )
  60. $Width = $prop['WIDTH'];
  61. else
  62. $Width = $this->w - $this->lMargin-$this->rMargin;
  63. $this->Ln(2);
  64. $x = $this->GetX();
  65. $y = $this->GetY();
  66. $this->SetLineWidth(0.4);
  67. $this->Line($x,$y,$x+$Width,$y);
  68. $this->SetLineWidth(0.2);
  69. $this->Ln(2);
  70. }
  71. }
  72.  
  73. function CloseTag($tag)
  74. {
  75. //Closing tag
  76. if($tag=='B' || $tag=='I' || $tag=='U')
  77. $this->SetStyle($tag,false);
  78. if($tag=='A')
  79. $this->HREF='';
  80. if($tag=='P')
  81. $this->ALIGN='';
  82. }
  83.  
  84. function SetStyle($tag,$enable)
  85. {
  86. //Modify style and select corresponding font
  87. $this->$tag+=($enable ? 1 : -1);
  88. $style='';
  89. foreach(array('B','I','U') as $s)
  90. if($this->$s>0)
  91. $style.=$s;
  92. $this->SetFont('',$style);
  93. }
  94.  
  95. function PutLink($URL,$txt)
  96. {
  97. //Put a hyperlink
  98. $this->SetTextColor(0,0,255);
  99. $this->SetStyle('U',true);
  100. $this->Write(5,$txt,$URL);
  101. $this->SetStyle('U',false);
  102. $this->SetTextColor(0);
  103. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 19:48