From: Andrew G. <aga...@re...> - 2015-02-11 22:19:30
|
I am trouble shooting the same problem today where it wraps text smaller than the width. The added $s = trim($s).' ';" causes an issue for me. Or you can change a do while loop from < to <= $nb and it appears to fix same issue. My worry was testing all existing forms. If you can send me your update I will test it in my environment for all my forms. Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network. From: Rafael Chacón Sent: Wednesday, February 11, 2015 3:26 PM To: webERP Developers Reply To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Vitaly, Thank you for writing. About "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": This line returns an array of strings, each of which is a substring of $myrow2['narrative'] formed by splitting it on boundaries formed by the characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 uses Carriage_Return). The problem in PrintCustTransPortrait.php (and other reports) is caused by two bugs in AddTextWarp(): 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra white line). 2. Lines from 106 to 164: (the logic of the code -> splitting in the last white_space of a segment smaller that the cell width). My purpose in asking if someone "has problem with this function (last line line-feeded before the end) ?" is know who else experiences that problem. I have a new AddTextWrap that fixes both bugs. It is faster and produces PDF files with a slightly smaller size, but --obviously-- it not produce the extra blank line in segments smaller than cell width. Many users like this (no extra blank line) but there are some users who ask me to re-do this extra blank line. I would like other people tests this new AddTextWrap. Although this extra blank line is a bug, I am not comfortable with the idea of a potential change in actual reports. Best regards, Rafael. 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...<mailto:vsh...@so...>>: Rafael, The addTextWrap() does not split the line like that. It is done by this function $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); in PrintCustTransPortrait.php Vitaly On 2/10/2015 9:38 PM, Rafael Chacón wrote: HI Phil, Thank you for your answer. Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think it will be better to directly use TCPDF: (a) Y-coordinate= instead of calculating as from page-bottom to cell-bottom and the script class.pdf.php translates to page-top to cell-top to use tcpdf.php, we can directly use page-top to cell-top and TCPDF; (b) TCPDF has interesting functions (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into a pdf. Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give more options to reports. Topic 3: With PrintCustTransPortrait.php (and other reports) I have unexpected breaks (see enclose) and prints lines with whitespace. The problems are inside AddTextWarp(). Regards, Rafael. 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...<mailto:ph...@lo...>>: Yes originally used R & OS pdf library. Moved to Oliver Plathey FPDF http://www.fpdf.org/ The class.pdf.php was created to allow the transition to FPDF ... then to TCPDF which was a development of FPDF which allowed utf-8 pdfs - using CID fonts rather than embedding a large monster font file into each pdf - so a small 10k report becomes 2 Meg. This was not considered acceptable. I update tcpdf from time to time. Not sure about 3. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 10/02/15 13:37, Rafael Chacón wrote: Hi, Some questions: 1. webERP begun using PHP Pdf creation - R&OS (http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF (http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old code). Is it right? 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version 6.2.6 ? 3. Someone has replaced the function AddTextWarp() or has problem with this function (last line line-feeded before the end) ? Best regards, Rafael. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Rafael C. <raf...@gm...> - 2015-02-11 22:44:52
Attachments:
_AddTextWrapNEW.zip
|
Hi Andrew, I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace AddTextWrap lines (80-169) with lines 3-66 of the included file. Comments: * I'm testing with last version of Nicola Asuni's TCPDF. * It is possible to replace line 56 ("$textwidth += $this->GetStringWidth($c);") with two lines. Those two lines makes the function a little faster in some cases ($text width near the cell width), but slower in other cases ($text width far from the cell width). Best regards, Rafael. 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...>: > I am trouble shooting the same problem today where it wraps text smaller > than the width. The added $s = trim($s).' ';" causes an issue for me. Or > you can change a do while loop from < to <= $nb and it appears to fix same > issue. My worry was testing all existing forms. If you can send me your > update I will test it in my environment for all my forms. > > Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE > network. > *From: *Rafael Chacón > *Sent: *Wednesday, February 11, 2015 3:26 PM > *To: *webERP Developers > *Reply To: *webERP Developers > *Subject: *Re: [WebERP-developers] PDF generator in webERP. > > Hi Vitaly, > > Thank you for writing. > > About > "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": > This line returns an array of strings, each of which is a substring of > $myrow2['narrative'] formed by splitting it on boundaries formed by the > characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for > msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 > uses Carriage_Return). > > The problem in PrintCustTransPortrait.php (and other reports) is caused by > two bugs in AddTextWarp(): > > 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra > white line). > 2. Lines from 106 to 164: (the logic of the code -> splitting in the last > white_space of a segment smaller that the cell width). > > My purpose in asking if someone "has problem with this function (last line > line-feeded before the end) ?" is know who else experiences that problem. > > I have a new AddTextWrap that fixes both bugs. It is faster and produces > PDF files with a slightly smaller size, but --obviously-- it not produce > the extra blank line in segments smaller than cell width. Many users like > this (no extra blank line) but there are some users who ask me to re-do > this extra blank line. > > I would like other people tests this new AddTextWrap. Although this extra > blank line is a bug, I am not comfortable with the idea of a potential > change in actual reports. > > Best regards, Rafael. > > > 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: > >> Rafael, >> >> The addTextWrap() does not split the line like that. It is done by this >> function >> $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); >> >> in PrintCustTransPortrait.php >> >> >> Vitaly >> >> >> On 2/10/2015 9:38 PM, Rafael Chacón wrote: >> >> HI Phil, >> >> Thank you for your answer. >> >> Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think >> it will be better to directly use TCPDF: (a) Y-coordinate= instead of >> calculating as from page-bottom to cell-bottom and the script class.pdf.php >> translates to page-top to cell-top to use tcpdf.php, we can directly use >> page-top to cell-top and TCPDF; (b) TCPDF has interesting functions >> (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into >> a pdf. >> >> Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give more >> options to reports. >> >> Topic 3: With PrintCustTransPortrait.php (and other reports) I have >> unexpected breaks (see enclose) and prints lines with whitespace. The >> problems are inside AddTextWarp(). >> >> Regards, Rafael. >> >> >> 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...>: >> >>> Yes originally used R & OS pdf library. >>> Moved to Oliver Plathey FPDF http://www.fpdf.org/ >>> The class.pdf.php was created to allow the transition to FPDF >>> ... then to TCPDF which was a development of FPDF which allowed utf-8 >>> pdfs - using CID fonts rather than embedding a large monster font file into >>> each pdf - so a small 10k report becomes 2 Meg. This was not considered >>> acceptable. >>> I update tcpdf from time to time. >>> >>> Not sure about 3. >>> >>> Phil >>> >>> Phil Daintree >>> Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz >>> >>> On 10/02/15 13:37, Rafael Chacón wrote: >>> >>> Hi, >>> >>> Some questions: >>> >>> 1. webERP begun using PHP Pdf creation - R&OS ( >>> http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF ( >>> http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote >>> ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" >>> (old code). Is it right? >>> >>> 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version >>> 6.2.6 ? >>> >>> 3. Someone has replaced the function AddTextWarp() or has problem with >>> this function (last line line-feeded before the end) ? >>> >>> Best regards, Rafael. >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> >>> >>> >>> _______________________________________________ >>> Web-erp-developers mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is >>> your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take >>> a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> >> >> >> _______________________________________________ >> Web-erp-developers mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is >> your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |
From: Andrew G. <aga...@re...> - 2015-02-13 15:47:54
Attachments:
image003.jpg
|
The missing spaces would make me have to alter too many forms I believe but it is nice work. I think locally I can fix my issue with another small change. Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Rafael Chacón [mailto:raf...@gm...] Sent: Wednesday, February 11, 2015 4:45 PM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Andrew, I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace AddTextWrap lines (80-169) with lines 3-66 of the included file. Comments: * I'm testing with last version of Nicola Asuni's TCPDF. * It is possible to replace line 56 ("$textwidth += $this->GetStringWidth($c);") with two lines. Those two lines makes the function a little faster in some cases ($text width near the cell width), but slower in other cases ($text width far from the cell width). Best regards, Rafael. 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...<mailto:aga...@re...>>: I am trouble shooting the same problem today where it wraps text smaller than the width. The added $s = trim($s).' ';" causes an issue for me. Or you can change a do while loop from < to <= $nb and it appears to fix same issue. My worry was testing all existing forms. If you can send me your update I will test it in my environment for all my forms. Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network. From: Rafael Chacón Sent: Wednesday, February 11, 2015 3:26 PM To: webERP Developers Reply To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Vitaly, Thank you for writing. About "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": This line returns an array of strings, each of which is a substring of $myrow2['narrative'] formed by splitting it on boundaries formed by the characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 uses Carriage_Return). The problem in PrintCustTransPortrait.php (and other reports) is caused by two bugs in AddTextWarp(): 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra white line). 2. Lines from 106 to 164: (the logic of the code -> splitting in the last white_space of a segment smaller that the cell width). My purpose in asking if someone "has problem with this function (last line line-feeded before the end) ?" is know who else experiences that problem. I have a new AddTextWrap that fixes both bugs. It is faster and produces PDF files with a slightly smaller size, but --obviously-- it not produce the extra blank line in segments smaller than cell width. Many users like this (no extra blank line) but there are some users who ask me to re-do this extra blank line. I would like other people tests this new AddTextWrap. Although this extra blank line is a bug, I am not comfortable with the idea of a potential change in actual reports. Best regards, Rafael. 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...<mailto:vsh...@so...>>: Rafael, The addTextWrap() does not split the line like that. It is done by this function $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); in PrintCustTransPortrait.php Vitaly On 2/10/2015 9:38 PM, Rafael Chacón wrote: HI Phil, Thank you for your answer. Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think it will be better to directly use TCPDF: (a) Y-coordinate= instead of calculating as from page-bottom to cell-bottom and the script class.pdf.php translates to page-top to cell-top to use tcpdf.php, we can directly use page-top to cell-top and TCPDF; (b) TCPDF has interesting functions (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into a pdf. Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give more options to reports. Topic 3: With PrintCustTransPortrait.php (and other reports) I have unexpected breaks (see enclose) and prints lines with whitespace. The problems are inside AddTextWarp(). Regards, Rafael. 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...<mailto:ph...@lo...>>: Yes originally used R & OS pdf library. Moved to Oliver Plathey FPDF http://www.fpdf.org/ The class.pdf.php was created to allow the transition to FPDF ... then to TCPDF which was a development of FPDF which allowed utf-8 pdfs - using CID fonts rather than embedding a large monster font file into each pdf - so a small 10k report becomes 2 Meg. This was not considered acceptable. I update tcpdf from time to time. Not sure about 3. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 10/02/15 13:37, Rafael Chacón wrote: Hi, Some questions: 1. webERP begun using PHP Pdf creation - R&OS (http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF (http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old code). Is it right? 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version 6.2.6 ? 3. Someone has replaced the function AddTextWarp() or has problem with this function (last line line-feeded before the end) ? Best regards, Rafael. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Andrew G. <aga...@re...> - 2015-02-13 15:59:35
Attachments:
image003.jpg
image004.jpg
|
Actually. My issue seems to be with special characters. Any help is appreciated. I can’t seem to figure out why. This Doesn’t Wrap on the invoice TEST trademark ABC P-1700 CL 2612MPC This does wrap (Much Shorter but Trademark sign inside of it). I don’t want it to wrap. TEST ® ABC P-1700 CL 2612MPC I can make 1 modification that fixes it but I am unsure why it is needed and again not sure of what else it will affect. Original code line 293 ‘while($i<$nb)’ This code fixes it ‘while($i<=$nb)’ where ‘$nb=mb_strlen($s);’ Ideas? Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Andrew Galuski [mailto:aga...@re...] Sent: Friday, February 13, 2015 9:48 AM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. The missing spaces would make me have to alter too many forms I believe but it is nice work. I think locally I can fix my issue with another small change. Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Rafael Chacón [mailto:raf...@gm...] Sent: Wednesday, February 11, 2015 4:45 PM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Andrew, I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace AddTextWrap lines (80-169) with lines 3-66 of the included file. Comments: * I'm testing with last version of Nicola Asuni's TCPDF. * It is possible to replace line 56 ("$textwidth += $this->GetStringWidth($c);") with two lines. Those two lines makes the function a little faster in some cases ($text width near the cell width), but slower in other cases ($text width far from the cell width). Best regards, Rafael. 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...<mailto:aga...@re...>>: I am trouble shooting the same problem today where it wraps text smaller than the width. The added $s = trim($s).' ';" causes an issue for me. Or you can change a do while loop from < to <= $nb and it appears to fix same issue. My worry was testing all existing forms. If you can send me your update I will test it in my environment for all my forms. Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network. From: Rafael Chacón Sent: Wednesday, February 11, 2015 3:26 PM To: webERP Developers Reply To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Vitaly, Thank you for writing. About "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": This line returns an array of strings, each of which is a substring of $myrow2['narrative'] formed by splitting it on boundaries formed by the characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 uses Carriage_Return). The problem in PrintCustTransPortrait.php (and other reports) is caused by two bugs in AddTextWarp(): 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra white line). 2. Lines from 106 to 164: (the logic of the code -> splitting in the last white_space of a segment smaller that the cell width). My purpose in asking if someone "has problem with this function (last line line-feeded before the end) ?" is know who else experiences that problem. I have a new AddTextWrap that fixes both bugs. It is faster and produces PDF files with a slightly smaller size, but --obviously-- it not produce the extra blank line in segments smaller than cell width. Many users like this (no extra blank line) but there are some users who ask me to re-do this extra blank line. I would like other people tests this new AddTextWrap. Although this extra blank line is a bug, I am not comfortable with the idea of a potential change in actual reports. Best regards, Rafael. 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...<mailto:vsh...@so...>>: Rafael, The addTextWrap() does not split the line like that. It is done by this function $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); in PrintCustTransPortrait.php Vitaly On 2/10/2015 9:38 PM, Rafael Chacón wrote: HI Phil, Thank you for your answer. Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think it will be better to directly use TCPDF: (a) Y-coordinate= instead of calculating as from page-bottom to cell-bottom and the script class.pdf.php translates to page-top to cell-top to use tcpdf.php, we can directly use page-top to cell-top and TCPDF; (b) TCPDF has interesting functions (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into a pdf. Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give more options to reports. Topic 3: With PrintCustTransPortrait.php (and other reports) I have unexpected breaks (see enclose) and prints lines with whitespace. The problems are inside AddTextWarp(). Regards, Rafael. 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...<mailto:ph...@lo...>>: Yes originally used R & OS pdf library. Moved to Oliver Plathey FPDF http://www.fpdf.org/ The class.pdf.php was created to allow the transition to FPDF ... then to TCPDF which was a development of FPDF which allowed utf-8 pdfs - using CID fonts rather than embedding a large monster font file into each pdf - so a small 10k report becomes 2 Meg. This was not considered acceptable. I update tcpdf from time to time. Not sure about 3. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 10/02/15 13:37, Rafael Chacón wrote: Hi, Some questions: 1. webERP begun using PHP Pdf creation - R&OS (http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF (http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old code). Is it right? 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version 6.2.6 ? 3. Someone has replaced the function AddTextWarp() or has problem with this function (last line line-feeded before the end) ? Best regards, Rafael. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Rafael C. <raf...@gm...> - 2015-02-13 19:53:37
|
Hi, I enclose a uptdate to new addTextWrap. Changes: 1. Sets encoding 'UTF-8' in all multi-byte functions. 2. Adds the replace of '\n' text with a line feed character. This is to fix the possible introduction of a '\n' text instead of a line feed character. 3. Adds the delete of '\r' text. This is to fix the possible introduction of a '\r' text instead of a carriage return character. 4. Replaces hard hypen with soft hyphen as possible break position. 5. Privileges the use of mb_substr() instead of $text{$i} (deprecated? not multi-byte safe?) and $text[$i] (not multi-byte safe?). 6. Uses "greater than or equal to" comparison instead of "greater than" to cover the possibility of exact matches to exit for() loop. 7. Uses "less than or equal to" comparison instead of "less than" to cover the possibility of exact matches to exit for() loop. 8. Excludes the break character from the returned string. 9. Improves documentation and formatting. Best regards, Rafael. 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re...>: > Actually. > > My issue seems to be with special characters. Any help is appreciated. I > can’t seem to figure out why. > > This Doesn’t Wrap on the invoice > > TEST trademark ABC P-1700 CL 2612MPC > > > This does wrap (Much Shorter but Trademark sign inside of it). I don’t > want it to wrap. > > TEST ® ABC P-1700 CL 2612MPC > > > > I can make 1 modification that fixes it but I am unsure why it is needed > and again not sure of what else it will affect. > > Original code line 293 ‘while($i<$nb)’ > > This code fixes it ‘while($i<=$nb)’ > > > > where > > ‘$nb=mb_strlen($s);’ > > > > Ideas? > > > > > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com > > [image: resmart_logo] > > > > *From:* Andrew Galuski [mailto:aga...@re...] > *Sent:* Friday, February 13, 2015 9:48 AM > > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > > > The missing spaces would make me have to alter too many forms I believe > but it is nice work. > > I think locally I can fix my issue with another small change. > > > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com > > [image: resmart_logo] > > > > *From:* Rafael Chacón [mailto:raf...@gm... > <raf...@gm...>] > *Sent:* Wednesday, February 11, 2015 4:45 PM > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > > > Hi Andrew, > > I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace > AddTextWrap lines (80-169) with lines 3-66 of the included file. > > Comments: > * I'm testing with last version of Nicola Asuni's TCPDF. > * It is possible to replace line 56 ("$textwidth += > $this->GetStringWidth($c);") with two lines. Those two lines makes the > function a little faster in some cases ($text width near the cell width), > but slower in other cases ($text width far from the cell width). > > Best regards, Rafael. > > > > 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...>: > > I am trouble shooting the same problem today where it wraps text smaller > than the width. The added $s = trim($s).' ';" causes an issue for me. Or > you can change a do while loop from < to <= $nb and it appears to fix same > issue. My worry was testing all existing forms. If you can send me your > update I will test it in my environment for all my forms. > > > > Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE > network. > > *From: *Rafael Chacón > > *Sent: *Wednesday, February 11, 2015 3:26 PM > > *To: *webERP Developers > > *Reply To: *webERP Developers > > *Subject: *Re: [WebERP-developers] PDF generator in webERP. > > > > Hi Vitaly, > > Thank you for writing. > > About > "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": > This line returns an array of strings, each of which is a substring of > $myrow2['narrative'] formed by splitting it on boundaries formed by the > characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for > msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 > uses Carriage_Return). > > The problem in PrintCustTransPortrait.php (and other reports) is caused by > two bugs in AddTextWarp(): > > 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra > white line). > 2. Lines from 106 to 164: (the logic of the code -> splitting in the last > white_space of a segment smaller that the cell width). > > My purpose in asking if someone "has problem with this function (last line > line-feeded before the end) ?" is know who else experiences that problem. > > I have a new AddTextWrap that fixes both bugs. It is faster and produces > PDF files with a slightly smaller size, but --obviously-- it not produce > the extra blank line in segments smaller than cell width. Many users like > this (no extra blank line) but there are some users who ask me to re-do > this extra blank line. > > I would like other people tests this new AddTextWrap. Although this extra > blank line is a bug, I am not comfortable with the idea of a potential > change in actual reports. > > Best regards, Rafael. > > > > 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: > > Rafael, > > The addTextWrap() does not split the line like that. It is done by this > function > $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); > > in PrintCustTransPortrait.php > > > Vitaly > > > > On 2/10/2015 9:38 PM, Rafael Chacón wrote: > > HI Phil, > > Thank you for your answer. > > Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think > it will be better to directly use TCPDF: (a) Y-coordinate= instead of > calculating as from page-bottom to cell-bottom and the script class.pdf.php > translates to page-top to cell-top to use tcpdf.php, we can directly use > page-top to cell-top and TCPDF; (b) TCPDF has interesting functions > (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into > a pdf. > > Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give > more options to reports. > > Topic 3: With PrintCustTransPortrait.php (and other reports) I have > unexpected breaks (see enclose) and prints lines with whitespace. The > problems are inside AddTextWarp(). > > Regards, Rafael. > > > > 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...>: > > Yes originally used R & OS pdf library. > Moved to Oliver Plathey FPDF http://www.fpdf.org/ > The class.pdf.php was created to allow the transition to FPDF > ... then to TCPDF which was a development of FPDF which allowed utf-8 > pdfs - using CID fonts rather than embedding a large monster font file into > each pdf - so a small 10k report becomes 2 Meg. This was not considered > acceptable. > I update tcpdf from time to time. > > Not sure about 3. > > Phil > > > > Phil Daintree > > Logic Works Ltd - +64 (0)275 567890 > > http://www.logicworks.co.nz > > On 10/02/15 13:37, Rafael Chacón wrote: > > Hi, > > Some questions: > > 1. webERP begun using PHP Pdf creation - R&OS ( > http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF ( > http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote > ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" > (old code). Is it right? > > 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version > 6.2.6 ? > > 3. Someone has replaced the function AddTextWarp() or has problem with > this function (last line line-feeded before the end) ? > > Best regards, Rafael. > > > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming. The Go Parallel Website, > > sponsored by Intel and developed in partnership with Slashdot Media, is your > > hub for all things parallel software development, from weekly thought > > leadership blogs to news, videos, case studies, tutorials and more. Take a > > look and join the conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming. The Go Parallel Website, > > sponsored by Intel and developed in partnership with Slashdot Media, is your > > hub for all things parallel software development, from weekly thought > > leadership blogs to news, videos, case studies, tutorials and more. Take a > > look and join the conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |
From: Andrew G. <aga...@re...> - 2015-02-13 19:57:48
|
Thank you. I was hoping to be able to fix my existing version although if I pointed out a small issue with your new version you were able to fix I think that is good too. I will try the new version again however if blank spaces are gone I will not be able to use it, too much places to go add extra lines back in for readability. Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Rafael Chacón [mailto:raf...@gm...] Sent: Friday, February 13, 2015 1:53 PM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi, I enclose a uptdate to new addTextWrap. Changes: 1. Sets encoding 'UTF-8' in all multi-byte functions. 2. Adds the replace of '\n' text with a line feed character. This is to fix the possible introduction of a '\n' text instead of a line feed character. 3. Adds the delete of '\r' text. This is to fix the possible introduction of a '\r' text instead of a carriage return character. 4. Replaces hard hypen with soft hyphen as possible break position. 5. Privileges the use of mb_substr() instead of $text{$i} (deprecated? not multi-byte safe?) and $text[$i] (not multi-byte safe?). 6. Uses "greater than or equal to" comparison instead of "greater than" to cover the possibility of exact matches to exit for() loop. 7. Uses "less than or equal to" comparison instead of "less than" to cover the possibility of exact matches to exit for() loop. 8. Excludes the break character from the returned string. 9. Improves documentation and formatting. Best regards, Rafael. 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re...<mailto:aga...@re...>>: Actually. My issue seems to be with special characters. Any help is appreciated. I can’t seem to figure out why. This Doesn’t Wrap on the invoice TEST trademark ABC P-1700 CL 2612MPC This does wrap (Much Shorter but Trademark sign inside of it). I don’t want it to wrap. TEST ® ABC P-1700 CL 2612MPC I can make 1 modification that fixes it but I am unsure why it is needed and again not sure of what else it will affect. Original code line 293 ‘while($i<$nb)’ This code fixes it ‘while($i<=$nb)’ where ‘$nb=mb_strlen($s);’ Ideas? Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Andrew Galuski [mailto:aga...@re...<mailto:aga...@re...>] Sent: Friday, February 13, 2015 9:48 AM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. The missing spaces would make me have to alter too many forms I believe but it is nice work. I think locally I can fix my issue with another small change. Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Rafael Chacón [mailto:raf...@gm...] Sent: Wednesday, February 11, 2015 4:45 PM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Andrew, I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace AddTextWrap lines (80-169) with lines 3-66 of the included file. Comments: * I'm testing with last version of Nicola Asuni's TCPDF. * It is possible to replace line 56 ("$textwidth += $this->GetStringWidth($c);") with two lines. Those two lines makes the function a little faster in some cases ($text width near the cell width), but slower in other cases ($text width far from the cell width). Best regards, Rafael. 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...<mailto:aga...@re...>>: I am trouble shooting the same problem today where it wraps text smaller than the width. The added $s = trim($s).' ';" causes an issue for me. Or you can change a do while loop from < to <= $nb and it appears to fix same issue. My worry was testing all existing forms. If you can send me your update I will test it in my environment for all my forms. Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network. From: Rafael Chacón Sent: Wednesday, February 11, 2015 3:26 PM To: webERP Developers Reply To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Vitaly, Thank you for writing. About "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": This line returns an array of strings, each of which is a substring of $myrow2['narrative'] formed by splitting it on boundaries formed by the characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 uses Carriage_Return). The problem in PrintCustTransPortrait.php (and other reports) is caused by two bugs in AddTextWarp(): 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra white line). 2. Lines from 106 to 164: (the logic of the code -> splitting in the last white_space of a segment smaller that the cell width). My purpose in asking if someone "has problem with this function (last line line-feeded before the end) ?" is know who else experiences that problem. I have a new AddTextWrap that fixes both bugs. It is faster and produces PDF files with a slightly smaller size, but --obviously-- it not produce the extra blank line in segments smaller than cell width. Many users like this (no extra blank line) but there are some users who ask me to re-do this extra blank line. I would like other people tests this new AddTextWrap. Although this extra blank line is a bug, I am not comfortable with the idea of a potential change in actual reports. Best regards, Rafael. 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...<mailto:vsh...@so...>>: Rafael, The addTextWrap() does not split the line like that. It is done by this function $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); in PrintCustTransPortrait.php Vitaly On 2/10/2015 9:38 PM, Rafael Chacón wrote: HI Phil, Thank you for your answer. Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think it will be better to directly use TCPDF: (a) Y-coordinate= instead of calculating as from page-bottom to cell-bottom and the script class.pdf.php translates to page-top to cell-top to use tcpdf.php, we can directly use page-top to cell-top and TCPDF; (b) TCPDF has interesting functions (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into a pdf. Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give more options to reports. Topic 3: With PrintCustTransPortrait.php (and other reports) I have unexpected breaks (see enclose) and prints lines with whitespace. The problems are inside AddTextWarp(). Regards, Rafael. 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...<mailto:ph...@lo...>>: Yes originally used R & OS pdf library. Moved to Oliver Plathey FPDF http://www.fpdf.org/ The class.pdf.php was created to allow the transition to FPDF ... then to TCPDF which was a development of FPDF which allowed utf-8 pdfs - using CID fonts rather than embedding a large monster font file into each pdf - so a small 10k report becomes 2 Meg. This was not considered acceptable. I update tcpdf from time to time. Not sure about 3. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 10/02/15 13:37, Rafael Chacón wrote: Hi, Some questions: 1. webERP begun using PHP Pdf creation - R&OS (http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF (http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old code). Is it right? 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version 6.2.6 ? 3. Someone has replaced the function AddTextWarp() or has problem with this function (last line line-feeded before the end) ? Best regards, Rafael. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Rafael C. <raf...@gm...> - 2015-02-13 20:14:16
Attachments:
image003.jpg
image004.jpg
|
Hi Andrew, Sorry, just I read you messages. Yes, as I said in previous messages, this new AddTextWrap fixes the extra blank line bug. But if any user like this extra blank line bug, there is lot of work adding a extra line to reports. About the problem with your text: I think the text does not wrap because it is using a non-breaking space character instead of a white space character. A possible fix: $nbsp = html_entity_decode(' ', ENT_QUOTES, 'UTF-8');// Converts non-breaking space HTML entity to their applicable character. $text = str_replace($nbsp,' ',$text); Best regards, Rafael. 2015-02-13 13:53 GMT-06:00 Rafael Chacón <raf...@gm...>: > Hi, > > I enclose a uptdate to new addTextWrap. > > Changes: > 1. Sets encoding 'UTF-8' in all multi-byte functions. > 2. Adds the replace of '\n' text with a line feed character. This is to > fix the possible introduction of a '\n' text instead of a line feed > character. > 3. Adds the delete of '\r' text. This is to fix the possible introduction > of a '\r' text instead of a carriage return character. > 4. Replaces hard hypen with soft hyphen as possible break position. > 5. Privileges the use of mb_substr() instead of $text{$i} (deprecated? not > multi-byte safe?) and $text[$i] (not multi-byte safe?). > 6. Uses "greater than or equal to" comparison instead of "greater than" to > cover the possibility of exact matches to exit for() loop. > 7. Uses "less than or equal to" comparison instead of "less than" to cover > the possibility of exact matches to exit for() loop. > 8. Excludes the break character from the returned string. > 9. Improves documentation and formatting. > > Best regards, Rafael. > > 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re...>: > > Actually. >> >> My issue seems to be with special characters. Any help is appreciated. >> I can’t seem to figure out why. >> >> This Doesn’t Wrap on the invoice >> >> TEST trademark ABC P-1700 CL 2612MPC >> >> >> This does wrap (Much Shorter but Trademark sign inside of it). I don’t >> want it to wrap. >> >> TEST ® ABC P-1700 CL 2612MPC >> >> >> >> I can make 1 modification that fixes it but I am unsure why it is needed >> and again not sure of what else it will affect. >> >> Original code line 293 ‘while($i<$nb)’ >> >> This code fixes it ‘while($i<=$nb)’ >> >> >> >> where >> >> ‘$nb=mb_strlen($s);’ >> >> >> >> Ideas? >> >> >> >> >> >> Best Regards, >> >> Andrew Galuski >> >> ResMart LLC. >> >> 817.615.2038 (Office) >> >> 817.821.0544 (Cell) >> >> www.resmart.com >> >> [image: resmart_logo] >> >> >> >> *From:* Andrew Galuski [mailto:aga...@re...] >> *Sent:* Friday, February 13, 2015 9:48 AM >> >> *To:* webERP Developers >> *Subject:* Re: [WebERP-developers] PDF generator in webERP. >> >> >> >> The missing spaces would make me have to alter too many forms I believe >> but it is nice work. >> >> I think locally I can fix my issue with another small change. >> >> >> >> Best Regards, >> >> Andrew Galuski >> >> ResMart LLC. >> >> 817.615.2038 (Office) >> >> 817.821.0544 (Cell) >> >> www.resmart.com >> >> [image: resmart_logo] >> >> >> >> *From:* Rafael Chacón [mailto:raf...@gm... >> <raf...@gm...>] >> *Sent:* Wednesday, February 11, 2015 4:45 PM >> *To:* webERP Developers >> *Subject:* Re: [WebERP-developers] PDF generator in webERP. >> >> >> >> Hi Andrew, >> >> I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace >> AddTextWrap lines (80-169) with lines 3-66 of the included file. >> >> Comments: >> * I'm testing with last version of Nicola Asuni's TCPDF. >> * It is possible to replace line 56 ("$textwidth += >> $this->GetStringWidth($c);") with two lines. Those two lines makes the >> function a little faster in some cases ($text width near the cell width), >> but slower in other cases ($text width far from the cell width). >> >> Best regards, Rafael. >> >> >> >> 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...>: >> >> I am trouble shooting the same problem today where it wraps text smaller >> than the width. The added $s = trim($s).' ';" causes an issue for me. >> Or you can change a do while loop from < to <= $nb and it appears to fix >> same issue. My worry was testing all existing forms. If you can send me >> your update I will test it in my environment for all my forms. >> >> >> >> Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE >> network. >> >> *From: *Rafael Chacón >> >> *Sent: *Wednesday, February 11, 2015 3:26 PM >> >> *To: *webERP Developers >> >> *Reply To: *webERP Developers >> >> *Subject: *Re: [WebERP-developers] PDF generator in webERP. >> >> >> >> Hi Vitaly, >> >> Thank you for writing. >> >> About >> "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": >> This line returns an array of strings, each of which is a substring of >> $myrow2['narrative'] formed by splitting it on boundaries formed by the >> characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for >> msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 >> uses Carriage_Return). >> >> The problem in PrintCustTransPortrait.php (and other reports) is caused >> by two bugs in AddTextWarp(): >> >> 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra >> white line). >> 2. Lines from 106 to 164: (the logic of the code -> splitting in the last >> white_space of a segment smaller that the cell width). >> >> My purpose in asking if someone "has problem with this function (last >> line line-feeded before the end) ?" is know who else experiences that >> problem. >> >> I have a new AddTextWrap that fixes both bugs. It is faster and produces >> PDF files with a slightly smaller size, but --obviously-- it not produce >> the extra blank line in segments smaller than cell width. Many users like >> this (no extra blank line) but there are some users who ask me to re-do >> this extra blank line. >> >> I would like other people tests this new AddTextWrap. Although this extra >> blank line is a bug, I am not comfortable with the idea of a potential >> change in actual reports. >> >> Best regards, Rafael. >> >> >> >> 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: >> >> Rafael, >> >> The addTextWrap() does not split the line like that. It is done by this >> function >> $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); >> >> in PrintCustTransPortrait.php >> >> >> Vitaly >> >> >> >> On 2/10/2015 9:38 PM, Rafael Chacón wrote: >> >> HI Phil, >> >> Thank you for your answer. >> >> Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think >> it will be better to directly use TCPDF: (a) Y-coordinate= instead of >> calculating as from page-bottom to cell-bottom and the script class.pdf.php >> translates to page-top to cell-top to use tcpdf.php, we can directly use >> page-top to cell-top and TCPDF; (b) TCPDF has interesting functions >> (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into >> a pdf. >> >> Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to >> give more options to reports. >> >> Topic 3: With PrintCustTransPortrait.php (and other reports) I have >> unexpected breaks (see enclose) and prints lines with whitespace. The >> problems are inside AddTextWarp(). >> >> Regards, Rafael. >> >> >> >> 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...>: >> >> Yes originally used R & OS pdf library. >> Moved to Oliver Plathey FPDF http://www.fpdf.org/ >> The class.pdf.php was created to allow the transition to FPDF >> ... then to TCPDF which was a development of FPDF which allowed utf-8 >> pdfs - using CID fonts rather than embedding a large monster font file into >> each pdf - so a small 10k report becomes 2 Meg. This was not considered >> acceptable. >> I update tcpdf from time to time. >> >> Not sure about 3. >> >> Phil >> >> >> >> Phil Daintree >> >> Logic Works Ltd - +64 (0)275 567890 >> >> http://www.logicworks.co.nz >> >> On 10/02/15 13:37, Rafael Chacón wrote: >> >> Hi, >> >> Some questions: >> >> 1. webERP begun using PHP Pdf creation - R&OS ( >> http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF ( >> http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote >> ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" >> (old code). Is it right? >> >> 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version >> 6.2.6 ? >> >> 3. Someone has replaced the function AddTextWarp() or has problem with >> this function (last line line-feeded before the end) ? >> >> Best regards, Rafael. >> >> >> >> ------------------------------------------------------------------------------ >> >> Dive into the World of Parallel Programming. The Go Parallel Website, >> >> sponsored by Intel and developed in partnership with Slashdot Media, is your >> >> hub for all things parallel software development, from weekly thought >> >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> >> look and join the conversation now. http://goparallel.sourceforge.net/ >> >> >> >> _______________________________________________ >> >> Web-erp-developers mailing list >> >> Web...@li... >> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is >> your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Dive into the World of Parallel Programming. The Go Parallel Website, >> >> sponsored by Intel and developed in partnership with Slashdot Media, is your >> >> hub for all things parallel software development, from weekly thought >> >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> >> look and join the conversation now. http://goparallel.sourceforge.net/ >> >> >> >> _______________________________________________ >> >> Web-erp-developers mailing list >> >> Web...@li... >> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is >> your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is >> your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is >> your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> > |
From: Vitaly S. <vsh...@so...> - 2015-02-17 20:15:26
|
Hi all, Here some continuation on the printing adventures. Tim suggested that some/most reports do not need to be rendered in PDF, but could be printed off the screen using Print button in the browser. To do that the layout of the page needs to be adjusted using a separate CSS file. I have done a little research and created print.css file with the rules that apply only when the page is sent to the printer. It is done by specifying media="print" for the stylesheet. The print.css hides the menus, header and the footer. In addition, anything that does not need to be printed, can be marked as class="noprint". I modified the Balance Sheet, Income Statement and the Trial Balance to show how it is done. The changes are in the trunk. Hope you like it. Vitaly Hi, Sorry by the delay, I was busy with an urgent invoice problem. Tim: Thank you, very much, for the info about print stylesheets. Vitaly: Thank you, very much, for the link. Sounds interesting: write one code (report), generate to multiple media (outputs). Also, no character encoding problems (using HTML entities instead) and can include rich format (HTML formatting tags). I am thinking in: (1) Make the code for all reports so that they are generated by a "screen" stylesheet to render the page in the browser window; (2) In all reports include a button to print using a "print" stylesheet to render the page for a printer; and (3) Create a print stylesheet "print.css"; (4) Re-create a Form Designer to modify the the main cascading style sheet (CSS for screen). I agree that quotations and invoices are special cases. I need to generate PDFs to be sent by email. In this case, if no way, I prefer to use TCPDF (including generate barcodes). Best regards, Rafael. 2015-02-16 14:16 GMT-06:00 Vitaly Shevkunov <vsh...@so... <mailto:vsh...@so...>>: There is some guides on Internet on how to set up the print css. For example this one. http://www.webcredible.com/blog-reports/css/print-stylesheet.shtml I will try it here to see what I will get. Vitaly On 2/16/2015 3:58 AM, Tim Schofield wrote: > Hi Vitaly, yes you are correct it was the reports that I had in > mind, for instance the trial balance where we maintain two > completely separate pieces of code one for html and another for pdf. > > However a simple html template for an invoice, and a css > stylesheet to customise for each company should be a possibility? > Putting together a form designer to dynamically change this css > shouldn't be as big a problem as with a pdf. > > Tim > > On 15 February 2015 at 19:55, Vitaly Shevkunov > <vsh...@so... <mailto:vsh...@so...>> wrote: > > Tim, > > The css printing is fine for general output. I am not sure it > will work for creating specific forms, like quotations and > invoices. My biggest challenge is how to allow the end user to > customize their forms without php programming. If it could be > done by using css, then I will be happy to start using it. > Does anybody know a good form designer that would be easy to > use for an average person? > > Vitalt > > > On 2/15/2015 4:20 AM, Tim Schofield wrote: >> It is debatable whether we need to be generating pdf reports >> at all these days. You now have the option to use different >> css stylesheets depending upon the media that is being used >> to render the page. So you can have a "screen" stylesheet to >> render the page in the browser window, and a separate "print" >> stylesheet to render the page for a printer. This printer >> stylesheet would hide those elements not wanted in the >> printed output such as the menus and the footer etc, and all >> the user has to do is to press the print button in their >> browser to get a printed report. >> >> This way we don't have to duplicate code for pdf and html >> output, and also the browsers rendering engine takes care of >> line wrapping etc making sure the output always looks good. >> No messing about with all those pdf fonts either. >> >> If pdf output is still required browsers can still print to a >> pdf file. >> >> Tim >> >> On 14 February 2015 at 15:09, Rafael Chacón >> <raf...@gm... >> <mailto:raf...@gm...>> wrote: >> >> Hi Vitaly, >> >> I am happy that this code helps you. >> >> About putting the $fill parameter back: I think it is >> possible, but we need help. I explain myself: >> * In ~/includes/class.pdf.php, in function AddTextWrap(), >> there are two additional parameters: $border and $fill. >> $border is "translated" to 'LTRB' and sets two variables: >> $b and $b2; but $border and $b2 are not used to produce >> any output. Also $fill do not produce any output (only is >> mentioned in the argument list). >> * In R&OS there are two other parameters: $angle and >> $test. Those parameters have no relation with $border and >> $fill. We just copy for compatibility. >> * R&OS deletes addTextWrap() in version 0.12.2 and >> recommends to "use addText instead". The version we have >> has a little documentation ($test = "need to store the >> initial text state, as this will change during the width >> calculation but will need to be re-set before printing, >> so that the chars work out right"). >> >> We are assuming that $border and $fill were included in >> ~/includes/class.pdf.php with the same purpose they have >> in ~/includes/tcpdf/tcpdf.php. For compatibility >> purposes, We leave $angle and $test as they are in >> original R&OS's AddTextWrap() function. We add $border >> and $fill as they are in original Nicola Asuni's TCPDF >> library. I enclose this update. >> >> Here, the direct use of Nicola Asuni's TCPDF library is >> preferred. I agree with that those functions have more >> features and the scripts will be faster, but I am not >> sure about implications of this for users (e.g. fixing >> the extra blank line bug). >> >> Best regards, Rafael. >> >> >> 2015-02-13 21:05 GMT-06:00 Vitaly Shevkunov >> <vsh...@so... >> <mailto:vsh...@so...>>: >> >> Hi Rafael, >> >> I applied your updated function to my code and >> started testing. So far I like it very much. I does >> everything that I expected that function to do in the >> first place. I found some problems in some of my >> forms, but not too many. All of them due to my >> hacking, trying to get that function to do what it >> was not doing before. >> The only change I would make is to put the $fill >> parameter back. It is a very useful feature for me. >> >> Thank you very much >> >> Vitaly >> >> On 2/13/2015 2:14 PM, Rafael Chacón wrote: >>> Hi Andrew, >>> >>> Sorry, just I read you messages. >>> >>> Yes, as I said in previous messages, this new >>> AddTextWrap fixes the extra blank line bug. But if >>> any user like this extra blank line bug, there is >>> lot of work adding a extra line to reports. >>> >>> About the problem with your text: >>> >>> I think the text does not wrap because it is using a >>> non-breaking space character instead of a white >>> space character. >>> >>> A possible fix: >>> >>> $nbsp = html_entity_decode(' ', ENT_QUOTES, >>> 'UTF-8');// Converts non-breaking space HTML entity >>> to their applicable character. >>> $text = str_replace($nbsp,' ',$text); >>> >>> Best regards, Rafael. >>> >>> 2015-02-13 13:53 GMT-06:00 Rafael Chacón >>> <raf...@gm... >>> <mailto:raf...@gm...>>: >>> >>> Hi, >>> >>> I enclose a uptdate to new addTextWrap. >>> >>> Changes: >>> 1. Sets encoding 'UTF-8' in all multi-byte >>> functions. >>> 2. Adds the replace of '\n' text with a line >>> feed character. This is to fix the possible >>> introduction of a '\n' text instead of a line >>> feed character. >>> 3. Adds the delete of '\r' text. This is to fix >>> the possible introduction of a '\r' text instead >>> of a carriage return character. >>> 4. Replaces hard hypen with soft hyphen as >>> possible break position. >>> 5. Privileges the use of mb_substr() instead of >>> $text{$i} (deprecated? not multi-byte safe?) and >>> $text[$i] (not multi-byte safe?). >>> 6. Uses "greater than or equal to" comparison >>> instead of "greater than" to cover the >>> possibility of exact matches to exit for() loop. >>> 7. Uses "less than or equal to" comparison >>> instead of "less than" to cover the possibility >>> of exact matches to exit for() loop. >>> 8. Excludes the break character from the >>> returned string. >>> 9. Improves documentation and formatting. >>> >>> Best regards, Rafael. >>> >>> 2015-02-13 9:59 GMT-06:00 Andrew Galuski >>> <aga...@re... >>> <mailto:aga...@re...>>: >>> >>> Actually. >>> >>> My issue seems to be with special >>> characters. Any help is appreciated. I can’t >>> seem to figure out why. >>> >>> This Doesn’t Wrap on the invoice >>> >>> TEST trademark ABC P-1700 CL 2612MPC >>> >>> >>> This does wrap (Much Shorter but Trademark >>> sign inside of it). I don’t want it to wrap. >>> >>> TEST ® ABC P-1700 CL 2612MPC >>> >>> I can make 1 modification that fixes it but >>> I am unsure why it is needed and again not >>> sure of what else it will affect. >>> >>> Original code line 293 ‘while($i<$nb)’ >>> >>> This code fixes it ‘while($i<=$nb)’ >>> >>> where >>> >>> ‘$nb=mb_strlen($s);’ >>> >>> Ideas? >>> >>> Best Regards, >>> >>> Andrew Galuski >>> >>> ResMart LLC. >>> >>> 817.615.2038 (Office) >>> >>> 817.821.0544 (Cell) >>> >>> www.resmart.com <http://www.resmart.com> >>> >>> resmart_logo >>> >>> *From:*Andrew Galuski >>> [mailto:aga...@re... >>> <mailto:aga...@re...>] >>> *Sent:* Friday, February 13, 2015 9:48 AM >>> >>> >>> *To:* webERP Developers >>> *Subject:* Re: [WebERP-developers] PDF >>> generator in webERP. >>> >>> The missing spaces would make me have to >>> alter too many forms I believe but it is >>> nice work. >>> >>> I think locally I can fix my issue with >>> another small change. >>> >>> Best Regards, >>> >>> Andrew Galuski >>> >>> ResMart LLC. >>> >>> 817.615.2038 (Office) >>> >>> 817.821.0544 (Cell) >>> >>> www.resmart.com <http://www.resmart.com> >>> >>> resmart_logo >>> >>> *From:*Rafael Chacón >>> [mailto:raf...@gm...] >>> *Sent:* Wednesday, February 11, 2015 4:45 PM >>> *To:* webERP Developers >>> *Subject:* Re: [WebERP-developers] PDF >>> generator in webERP. >>> >>> Hi Andrew, >>> >>> I enclose my new AddTextWrap. Inside >>> ~/includes/class.pdf.php, replace >>> AddTextWrap lines (80-169) with lines 3-66 >>> of the included file. >>> >>> Comments: >>> * I'm testing with last version of Nicola >>> Asuni's TCPDF. >>> * It is possible to replace line 56 >>> ("$textwidth += $this->GetStringWidth($c);") >>> with two lines. Those two lines makes the >>> function a little faster in some cases >>> ($text width near the cell width), but >>> slower in other cases ($text width far from >>> the cell width). >>> >>> Best regards, Rafael. >>> >>> 2015-02-11 16:19 GMT-06:00 Andrew Galuski >>> <aga...@re... >>> <mailto:aga...@re...>>: >>> >>> I am trouble shooting the same problem today >>> where it wraps text smaller than the width. >>> The added $s = trim($s).' ';" causes an >>> issue for me. Or you can change a do while >>> loop from < to <= $nb and it appears to fix >>> same issue. My worry was testing all >>> existing forms. If you can send me your >>> update I will test it in my environment for >>> all my forms. >>> >>> Sent from my BlackBerry 10 smartphone on the >>> Verizon Wireless 4G LTE network. >>> >>> *From: *Rafael Chacón >>> >>> *Sent: *Wednesday, February 11, 2015 3:26 PM >>> >>> *To: *webERP Developers >>> >>> *Reply To: *webERP Developers >>> >>> *Subject: *Re: [WebERP-developers] PDF >>> generator in webERP. >>> >>> Hi Vitaly, >>> >>> Thank you for writing. >>> >>> About >>> "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": >>> This line returns an array of strings, each >>> of which is a substring of >>> $myrow2['narrative'] formed by splitting it >>> on boundaries formed by the characters >>> Carriage_Return ("\r") and Line_Feed ("\n"). >>> It only works for msWindows (Unix-like and >>> Mac OS-10 use Line_Feed; Mac OS up to >>> version 9 uses Carriage_Return). >>> >>> The problem in PrintCustTransPortrait.php >>> (and other reports) is caused by two bugs in >>> AddTextWarp(): >>> >>> 1. Line 108: "$s = trim($s).' ';" (extra >>> blank character -> the extra white line). >>> 2. Lines from 106 to 164: (the logic of the >>> code -> splitting in the last white_space of >>> a segment smaller that the cell width). >>> >>> My purpose in asking if someone "has problem >>> with this function (last line line-feeded >>> before the end) ?" is know who else >>> experiences that problem. >>> >>> I have a new AddTextWrap that fixes both >>> bugs. It is faster and produces PDF files >>> with a slightly smaller size, but >>> --obviously-- it not produce the extra blank >>> line in segments smaller than cell width. >>> Many users like this (no extra blank line) >>> but there are some users who ask me to re-do >>> this extra blank line. >>> >>> I would like other people tests this new >>> AddTextWrap. Although this extra blank line >>> is a bug, I am not comfortable with the idea >>> of a potential change in actual reports. >>> >>> Best regards, Rafael. >>> >>> 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov >>> <vsh...@so... >>> <mailto:vsh...@so...>>: >>> >>> Rafael, >>> >>> The addTextWrap() does not split the line >>> like that. It is done by this function >>> $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); >>> >>> in PrintCustTransPortrait.php >>> >>> >>> Vitaly >>> >>> >>> >>> On 2/10/2015 9:38 PM, Rafael Chacón wrote: >>> >>> HI Phil, >>> >>> Thank you for your answer. >>> >>> Topic 1: From R&OS -> FPDF -> TCPDF. For >>> future pdf development, I think it will >>> be better to directly use TCPDF: (a) >>> Y-coordinate= instead of calculating as >>> from page-bottom to cell-bottom and the >>> script class.pdf.php translates to >>> page-top to cell-top to use tcpdf.php, >>> we can directly use page-top to cell-top >>> and TCPDF; (b) TCPDF has interesting >>> functions (writeHTML, writeHTMLCell, >>> etc.) to write code html (a screen >>> report) into a pdf. >>> >>> Topic 2: tcpdf 6.2.6 has new fonts and >>> others.They may be helpful to give more >>> options to reports. >>> >>> Topic 3: With PrintCustTransPortrait.php >>> (and other reports) I have unexpected >>> breaks (see enclose) and prints lines >>> with whitespace. The problems are inside >>> AddTextWarp(). >>> >>> Regards, Rafael. >>> >>> 2015-02-09 22:34 GMT-06:00 Phil Daintree >>> <ph...@lo... >>> <mailto:ph...@lo...>>: >>> >>> Yes originally used R & OS pdf library. >>> Moved to Oliver Plathey FPDF >>> http://www.fpdf.org/ >>> The class.pdf.php was created to allow >>> the transition to FPDF >>> ... then to TCPDF which was a >>> development of FPDF which allowed utf-8 >>> pdfs - using CID fonts rather than >>> embedding a large monster font file into >>> each pdf - so a small 10k report becomes >>> 2 Meg. This was not considered acceptable. >>> I update tcpdf from time to time. >>> >>> Not sure about 3. >>> >>> Phil >>> >>> >>> >>> Phil Daintree >>> >>> Logic Works Ltd - +64 (0)275 567890 >>> >>> http://www.logicworks.co.nz >>> >>> On 10/02/15 13:37, Rafael Chacón wrote: >>> >>> Hi, >>> >>> Some questions: >>> >>> 1. webERP begun using PHP Pdf >>> creation - R&OS >>> (http://sourceforge.net/projects/pdf-php/). >>> Then, webERP moved to TCPDF >>> (http://www.tcpdf.org/). Javier de >>> Lorenzo-Cáceres wrote >>> ~/includes/class.pdf.php to use >>> TCPDF with "PHP_Pdf_creation_-_R&OS >>> syntax" (old code). Is it right? >>> >>> 2. Someone has updated the >>> ~/includes/tcpdf folder with TCPDF >>> version 6.2.6 ? >>> >>> 3. Someone has replaced the function >>> AddTextWarp() or has problem with >>> this function (last line line-feeded >>> before the end) ? >>> >>> Best regards, Rafael. >>> >>> ------------------------------------------------------------------------------ >>> >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> >>> hub for all things parallel software development, from weekly thought >>> >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> >>> look and join the conversation now.http://goparallel.sourceforge.net/ >>> >>> _______________________________________________ >>> >>> Web-erp-developers mailing list >>> >>> Web...@li... <mailto:Web...@li...> >>> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel >>> Programming. The Go Parallel Website, >>> sponsored by Intel and developed in >>> partnership with Slashdot Media, is your >>> hub for all things parallel software >>> development, from weekly thought >>> leadership blogs to news, videos, case >>> studies, tutorials and more. Take a >>> look and join the conversation now. >>> http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> ------------------------------------------------------------------------------ >>> >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> >>> hub for all things parallel software development, from weekly thought >>> >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> >>> look and join the conversation now.http://goparallel.sourceforge.net/ >>> >>> _______________________________________________ >>> >>> Web-erp-developers mailing list >>> >>> Web...@li... <mailto:Web...@li...> >>> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> No virus found in this message. >>> Checked by AVG - www.avg.com >>> <http://www.avg.com> >>> Version: 2015.0.5646 / Virus Database: >>> 4284/9096 - Release Date: 02/11/15 >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. >>> The Go Parallel Website, >>> sponsored by Intel and developed in >>> partnership with Slashdot Media, is your >>> hub for all things parallel software >>> development, from weekly thought >>> leadership blogs to news, videos, case >>> studies, tutorials and more. Take a >>> look and join the conversation now. >>> http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. >>> The Go Parallel Website, >>> sponsored by Intel and developed in >>> partnership with Slashdot Media, is your >>> hub for all things parallel software >>> development, from weekly thought >>> leadership blogs to news, videos, case >>> studies, tutorials and more. Take a >>> look and join the conversation now. >>> http://goparallel.sourceforge.net/ >>> <http://goparallel.sourceforge.net/> >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. >>> The Go Parallel Website, >>> sponsored by Intel and developed in >>> partnership with Slashdot Media, is your >>> hub for all things parallel software >>> development, from weekly thought >>> leadership blogs to news, videos, case >>> studies, tutorials and more. Take a >>> look and join the conversation now. >>> http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> >>> >>> >>> look and join the conversation now.http://goparallel.sourceforge.net/ >>> >>> >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> No virus found in this message. >>> Checked by AVG - www.avg.com <http://www.avg.com> >>> Version: 2015.0.5646 / Virus Database: 4284/9102 - >>> Release Date: 02/12/15 >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go >> Parallel Website, >> sponsored by Intel and developed in partnership with >> Slashdot Media, is your >> hub for all things parallel software development, >> from weekly thought >> leadership blogs to news, videos, case studies, >> tutorials and more. Take a >> look and join the conversation now. >> http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> <mailto:Web...@li...> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go >> Parallel Website, >> sponsored by Intel and developed in partnership with >> Slashdot Media, is your >> hub for all things parallel software development, from >> weekly thought >> leadership blogs to news, videos, case studies, tutorials >> and more. Take a >> look and join the conversation now. >> http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> <mailto:Web...@li...> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> >> -- >> Course View Towers, >> Plot 21 Yusuf Lule Road, >> Kampala >> T +256 (0) 312 314 418 >> M +256 (0) 752 963 325 >> www.weberpafrica.com <http://www.weberpafrica.com> >> Twitter: @TimSchofield2 >> Blog: http://weberpafrica.blogspot.co.uk/ >> No virus found in this message. >> Checked by AVG - www.avg.com <http://www.avg.com> >> Version: 2015.0.5646 / Virus Database: 4284/9112 - Release >> Date: 02/14/15 > > > > > -- > Course View Towers, > Plot 21 Yusuf Lule Road, > Kampala > T +256 (0) 312 314 418 > M +256 (0) 752 963 325 > www.weberpafrica.com <http://www.weberpafrica.com> > Twitter: @TimSchofield2 > Blog: http://weberpafrica.blogspot.co.uk/ > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 2015.0.5646 / Virus Database: 4284/9120 - Release Date: > 02/15/15 > No virus found in this message. Checked by AVG - www.avg.com <http://www.avg.com> Version: 2015.0.5646 / Virus Database: 4284/9126 - Release Date: 02/16/15 |
From: Phil D. <ph...@lo...> - 2015-02-18 05:56:44
|
This sounds a nice contribution - probably we should expand on this. I think Tim's rationale makes good sense. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 18/02/15 09:14, Vitaly Shevkunov wrote: > Hi all, > > Here some continuation on the printing adventures. > Tim suggested that some/most reports do not need to be rendered in > PDF, but could be printed off the screen using Print button in the > browser. To do that the layout of the page needs to be adjusted using > a separate CSS file. > I have done a little research and created print.css file with the > rules that apply only when the page is sent to the printer. It is done > by specifying media="print" for the stylesheet. > The print.css hides the menus, header and the footer. In addition, > anything that does not need to be printed, can be marked as > class="noprint". > > I modified the Balance Sheet, Income Statement and the Trial Balance > to show how it is done. > The changes are in the trunk. > > Hope you like it. > > Vitaly > > > Hi, > > Sorry by the delay, I was busy with an urgent invoice problem. > > Tim: Thank you, very much, for the info about print stylesheets. > Vitaly: Thank you, very much, for the link. > > Sounds interesting: write one code (report), generate to multiple > media (outputs). > Also, no character encoding problems (using HTML entities instead) and > can include rich format (HTML formatting tags). > > I am thinking in: > (1) Make the code for all reports so that they are generated by a > "screen" stylesheet to render the page in the browser window; > (2) In all reports include a button to print using a "print" > stylesheet to render the page for a printer; and > (3) Create a print stylesheet "print.css"; > (4) Re-create a Form Designer to modify the the main cascading style > sheet (CSS for screen). > > I agree that quotations and invoices are special cases. I need to > generate PDFs to be sent by email. In this case, if no way, I prefer > to use TCPDF (including generate barcodes). > > Best regards, Rafael. > > 2015-02-16 14:16 GMT-06:00 Vitaly Shevkunov <vsh...@so... > <mailto:vsh...@so...>>: > > There is some guides on Internet on how to set up the print css. > For example this one. > http://www.webcredible.com/blog-reports/css/print-stylesheet.shtml > > I will try it here to see what I will get. > > Vitaly > > On 2/16/2015 3:58 AM, Tim Schofield wrote: >> Hi Vitaly, yes you are correct it was the reports that I had in >> mind, for instance the trial balance where we maintain two >> completely separate pieces of code one for html and another for pdf. >> >> However a simple html template for an invoice, and a css >> stylesheet to customise for each company should be a possibility? >> Putting together a form designer to dynamically change this css >> shouldn't be as big a problem as with a pdf. >> >> Tim >> >> On 15 February 2015 at 19:55, Vitaly Shevkunov >> <vsh...@so... <mailto:vsh...@so...>> wrote: >> >> Tim, >> >> The css printing is fine for general output. I am not sure it >> will work for creating specific forms, like quotations and >> invoices. My biggest challenge is how to allow the end user >> to customize their forms without php programming. If it could >> be done by using css, then I will be happy to start using it. >> Does anybody know a good form designer that would be easy to >> use for an average person? >> >> Vitalt >> >> >> On 2/15/2015 4:20 AM, Tim Schofield wrote: >>> It is debatable whether we need to be generating pdf reports >>> at all these days. You now have the option to use different >>> css stylesheets depending upon the media that is being used >>> to render the page. So you can have a "screen" stylesheet to >>> render the page in the browser window, and a separate >>> "print" stylesheet to render the page for a printer. This >>> printer stylesheet would hide those elements not wanted in >>> the printed output such as the menus and the footer etc, and >>> all the user has to do is to press the print button in their >>> browser to get a printed report. >>> >>> This way we don't have to duplicate code for pdf and html >>> output, and also the browsers rendering engine takes care of >>> line wrapping etc making sure the output always looks good. >>> No messing about with all those pdf fonts either. >>> >>> If pdf output is still required browsers can still print to >>> a pdf file. >>> >>> Tim >>> >>> On 14 February 2015 at 15:09, Rafael Chacón >>> <raf...@gm... >>> <mailto:raf...@gm...>> wrote: >>> >>> Hi Vitaly, >>> >>> I am happy that this code helps you. >>> >>> About putting the $fill parameter back: I think it is >>> possible, but we need help. I explain myself: >>> * In ~/includes/class.pdf.php, in function >>> AddTextWrap(), there are two additional parameters: >>> $border and $fill. $border is "translated" to 'LTRB' and >>> sets two variables: $b and $b2; but $border and $b2 are >>> not used to produce any output. Also $fill do not >>> produce any output (only is mentioned in the argument list). >>> * In R&OS there are two other parameters: $angle and >>> $test. Those parameters have no relation with $border >>> and $fill. We just copy for compatibility. >>> * R&OS deletes addTextWrap() in version 0.12.2 and >>> recommends to "use addText instead". The version we have >>> has a little documentation ($test = "need to store the >>> initial text state, as this will change during the width >>> calculation but will need to be re-set before printing, >>> so that the chars work out right"). >>> >>> We are assuming that $border and $fill were included in >>> ~/includes/class.pdf.php with the same purpose they have >>> in ~/includes/tcpdf/tcpdf.php. For compatibility >>> purposes, We leave $angle and $test as they are in >>> original R&OS's AddTextWrap() function. We add $border >>> and $fill as they are in original Nicola Asuni's TCPDF >>> library. I enclose this update. >>> >>> Here, the direct use of Nicola Asuni's TCPDF library is >>> preferred. I agree with that those functions have more >>> features and the scripts will be faster, but I am not >>> sure about implications of this for users (e.g. fixing >>> the extra blank line bug). >>> >>> Best regards, Rafael. >>> >>> >>> 2015-02-13 21:05 GMT-06:00 Vitaly Shevkunov >>> <vsh...@so... >>> <mailto:vsh...@so...>>: >>> >>> Hi Rafael, >>> >>> I applied your updated function to my code and >>> started testing. So far I like it very much. I does >>> everything that I expected that function to do in >>> the first place. I found some problems in some of my >>> forms, but not too many. All of them due to my >>> hacking, trying to get that function to do what it >>> was not doing before. >>> The only change I would make is to put the $fill >>> parameter back. It is a very useful feature for me. >>> >>> Thank you very much >>> >>> Vitaly >>> >>> On 2/13/2015 2:14 PM, Rafael Chacón wrote: >>>> Hi Andrew, >>>> >>>> Sorry, just I read you messages. >>>> >>>> Yes, as I said in previous messages, this new >>>> AddTextWrap fixes the extra blank line bug. But if >>>> any user like this extra blank line bug, there is >>>> lot of work adding a extra line to reports. >>>> >>>> About the problem with your text: >>>> >>>> I think the text does not wrap because it is using >>>> a non-breaking space character instead of a white >>>> space character. >>>> >>>> A possible fix: >>>> >>>> $nbsp = html_entity_decode(' ', ENT_QUOTES, >>>> 'UTF-8');// Converts non-breaking space HTML entity >>>> to their applicable character. >>>> $text = str_replace($nbsp,' ',$text); >>>> >>>> Best regards, Rafael. >>>> >>>> 2015-02-13 13:53 GMT-06:00 Rafael Chacón >>>> <raf...@gm... >>>> <mailto:raf...@gm...>>: >>>> >>>> Hi, >>>> >>>> I enclose a uptdate to new addTextWrap. >>>> >>>> Changes: >>>> 1. Sets encoding 'UTF-8' in all multi-byte >>>> functions. >>>> 2. Adds the replace of '\n' text with a line >>>> feed character. This is to fix the possible >>>> introduction of a '\n' text instead of a line >>>> feed character. >>>> 3. Adds the delete of '\r' text. This is to fix >>>> the possible introduction of a '\r' text >>>> instead of a carriage return character. >>>> 4. Replaces hard hypen with soft hyphen as >>>> possible break position. >>>> 5. Privileges the use of mb_substr() instead of >>>> $text{$i} (deprecated? not multi-byte safe?) >>>> and $text[$i] (not multi-byte safe?). >>>> 6. Uses "greater than or equal to" comparison >>>> instead of "greater than" to cover the >>>> possibility of exact matches to exit for() loop. >>>> 7. Uses "less than or equal to" comparison >>>> instead of "less than" to cover the possibility >>>> of exact matches to exit for() loop. >>>> 8. Excludes the break character from the >>>> returned string. >>>> 9. Improves documentation and formatting. >>>> >>>> Best regards, Rafael. >>>> >>>> 2015-02-13 9:59 GMT-06:00 Andrew Galuski >>>> <aga...@re... >>>> <mailto:aga...@re...>>: >>>> >>>> Actually. >>>> >>>> My issue seems to be with special >>>> characters. Any help is appreciated. I >>>> can’t seem to figure out why. >>>> >>>> This Doesn’t Wrap on the invoice >>>> >>>> TEST trademark ABC P-1700 CL 2612MPC >>>> >>>> >>>> This does wrap (Much Shorter but Trademark >>>> sign inside of it). I don’t want it to wrap. >>>> >>>> TEST ® ABC P-1700 CL 2612MPC >>>> >>>> I can make 1 modification that fixes it but >>>> I am unsure why it is needed and again not >>>> sure of what else it will affect. >>>> >>>> Original code line 293 ‘while($i<$nb)’ >>>> >>>> This code fixes it ‘while($i<=$nb)’ >>>> >>>> where >>>> >>>> ‘$nb=mb_strlen($s);’ >>>> >>>> Ideas? >>>> >>>> Best Regards, >>>> >>>> Andrew Galuski >>>> >>>> ResMart LLC. >>>> >>>> 817.615.2038 (Office) >>>> >>>> 817.821.0544 (Cell) >>>> >>>> www.resmart.com <http://www.resmart.com> >>>> >>>> resmart_logo >>>> >>>> *From:*Andrew Galuski >>>> [mailto:aga...@re... >>>> <mailto:aga...@re...>] >>>> *Sent:* Friday, February 13, 2015 9:48 AM >>>> >>>> >>>> *To:* webERP Developers >>>> *Subject:* Re: [WebERP-developers] PDF >>>> generator in webERP. >>>> >>>> The missing spaces would make me have to >>>> alter too many forms I believe but it is >>>> nice work. >>>> >>>> I think locally I can fix my issue with >>>> another small change. >>>> >>>> Best Regards, >>>> >>>> Andrew Galuski >>>> >>>> ResMart LLC. >>>> >>>> 817.615.2038 (Office) >>>> >>>> 817.821.0544 (Cell) >>>> >>>> www.resmart.com <http://www.resmart.com> >>>> >>>> resmart_logo >>>> >>>> *From:*Rafael Chacón >>>> [mailto:raf...@gm...] >>>> *Sent:* Wednesday, February 11, 2015 4:45 PM >>>> *To:* webERP Developers >>>> *Subject:* Re: [WebERP-developers] PDF >>>> generator in webERP. >>>> >>>> Hi Andrew, >>>> >>>> I enclose my new AddTextWrap. Inside >>>> ~/includes/class.pdf.php, replace >>>> AddTextWrap lines (80-169) with lines 3-66 >>>> of the included file. >>>> >>>> Comments: >>>> * I'm testing with last version of Nicola >>>> Asuni's TCPDF. >>>> * It is possible to replace line 56 >>>> ("$textwidth += >>>> $this->GetStringWidth($c);") with two >>>> lines. Those two lines makes the function a >>>> little faster in some cases ($text width >>>> near the cell width), but slower in other >>>> cases ($text width far from the cell width). >>>> >>>> Best regards, Rafael. >>>> >>>> 2015-02-11 16:19 GMT-06:00 Andrew Galuski >>>> <aga...@re... >>>> <mailto:aga...@re...>>: >>>> >>>> I am trouble shooting the same problem >>>> today where it wraps text smaller than the >>>> width. The added $s = trim($s).' ';" causes >>>> an issue for me. Or you can change a do >>>> while loop from < to <= $nb and it appears >>>> to fix same issue. My worry was testing all >>>> existing forms. If you can send me your >>>> update I will test it in my environment for >>>> all my forms. >>>> >>>> Sent from my BlackBerry 10 smartphone on >>>> the Verizon Wireless 4G LTE network. >>>> >>>> *From: *Rafael Chacón >>>> >>>> *Sent: *Wednesday, February 11, 2015 3:26 PM >>>> >>>> *To: *webERP Developers >>>> >>>> *Reply To: *webERP Developers >>>> >>>> *Subject: *Re: [WebERP-developers] PDF >>>> generator in webERP. >>>> >>>> Hi Vitaly, >>>> >>>> Thank you for writing. >>>> >>>> About >>>> "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": >>>> This line returns an array of strings, each >>>> of which is a substring of >>>> $myrow2['narrative'] formed by splitting it >>>> on boundaries formed by the characters >>>> Carriage_Return ("\r") and Line_Feed >>>> ("\n"). It only works for msWindows >>>> (Unix-like and Mac OS-10 use Line_Feed; Mac >>>> OS up to version 9 uses Carriage_Return). >>>> >>>> The problem in PrintCustTransPortrait.php >>>> (and other reports) is caused by two bugs >>>> in AddTextWarp(): >>>> >>>> 1. Line 108: "$s = trim($s).' ';" (extra >>>> blank character -> the extra white line). >>>> 2. Lines from 106 to 164: (the logic of the >>>> code -> splitting in the last white_space >>>> of a segment smaller that the cell width). >>>> >>>> My purpose in asking if someone "has >>>> problem with this function (last line >>>> line-feeded before the end) ?" is know who >>>> else experiences that problem. >>>> >>>> I have a new AddTextWrap that fixes both >>>> bugs. It is faster and produces PDF files >>>> with a slightly smaller size, but >>>> --obviously-- it not produce the extra >>>> blank line in segments smaller than cell >>>> width. Many users like this (no extra blank >>>> line) but there are some users who ask me >>>> to re-do this extra blank line. >>>> >>>> I would like other people tests this new >>>> AddTextWrap. Although this extra blank line >>>> is a bug, I am not comfortable with the >>>> idea of a potential change in actual reports. >>>> >>>> Best regards, Rafael. >>>> >>>> 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov >>>> <vsh...@so... >>>> <mailto:vsh...@so...>>: >>>> >>>> Rafael, >>>> >>>> The addTextWrap() does not split the line >>>> like that. It is done by this function >>>> $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); >>>> >>>> in PrintCustTransPortrait.php >>>> >>>> >>>> Vitaly >>>> >>>> >>>> >>>> On 2/10/2015 9:38 PM, Rafael Chacón wrote: >>>> >>>> HI Phil, >>>> >>>> Thank you for your answer. >>>> >>>> Topic 1: From R&OS -> FPDF -> TCPDF. >>>> For future pdf development, I think it >>>> will be better to directly use TCPDF: >>>> (a) Y-coordinate= instead of >>>> calculating as from page-bottom to >>>> cell-bottom and the script >>>> class.pdf.php translates to page-top to >>>> cell-top to use tcpdf.php, we can >>>> directly use page-top to cell-top and >>>> TCPDF; (b) TCPDF has interesting >>>> functions (writeHTML, writeHTMLCell, >>>> etc.) to write code html (a screen >>>> report) into a pdf. >>>> >>>> Topic 2: tcpdf 6.2.6 has new fonts and >>>> others.They may be helpful to give more >>>> options to reports. >>>> >>>> Topic 3: With >>>> PrintCustTransPortrait.php (and other >>>> reports) I have unexpected breaks (see >>>> enclose) and prints lines with >>>> whitespace. The problems are inside >>>> AddTextWarp(). >>>> >>>> Regards, Rafael. >>>> >>>> 2015-02-09 22:34 GMT-06:00 Phil >>>> Daintree <ph...@lo... >>>> <mailto:ph...@lo...>>: >>>> >>>> Yes originally used R & OS pdf library. >>>> Moved to Oliver Plathey FPDF >>>> http://www.fpdf.org/ >>>> The class.pdf.php was created to allow >>>> the transition to FPDF >>>> ... then to TCPDF which was a >>>> development of FPDF which allowed utf-8 >>>> pdfs - using CID fonts rather than >>>> embedding a large monster font file >>>> into each pdf - so a small 10k report >>>> becomes 2 Meg. This was not considered >>>> acceptable. >>>> I update tcpdf from time to time. >>>> >>>> Not sure about 3. >>>> >>>> Phil >>>> >>>> >>>> >>>> Phil Daintree >>>> >>>> Logic Works Ltd - +64 (0)275 567890 >>>> >>>> http://www.logicworks.co.nz >>>> >>>> On 10/02/15 13:37, Rafael Chacón wrote: >>>> >>>> Hi, >>>> >>>> Some questions: >>>> >>>> 1. webERP begun using PHP Pdf >>>> creation - R&OS >>>> (http://sourceforge.net/projects/pdf-php/). >>>> Then, webERP moved to TCPDF >>>> (http://www.tcpdf.org/). Javier de >>>> Lorenzo-Cáceres wrote >>>> ~/includes/class.pdf.php to use >>>> TCPDF with "PHP_Pdf_creation_-_R&OS >>>> syntax" (old code). Is it right? >>>> >>>> 2. Someone has updated the >>>> ~/includes/tcpdf folder with TCPDF >>>> version 6.2.6 ? >>>> >>>> 3. Someone has replaced the >>>> function AddTextWarp() or has >>>> problem with this function (last >>>> line line-feeded before the end) ? >>>> >>>> Best regards, Rafael. >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> Dive into the World of Parallel Programming. The Go Parallel Website, >>>> >>>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>>> >>>> hub for all things parallel software development, from weekly thought >>>> >>>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>>> >>>> look and join the conversation now.http://goparallel.sourceforge.net/ >>>> >>>> _______________________________________________ >>>> >>>> Web-erp-developers mailing list >>>> >>>> Web...@li... <mailto:Web...@li...> >>>> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel >>>> Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in >>>> partnership with Slashdot Media, is your >>>> hub for all things parallel software >>>> development, from weekly thought >>>> leadership blogs to news, videos, case >>>> studies, tutorials and more. Take a >>>> look and join the conversation now. >>>> http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Web-erp-developers mailing list >>>> Web...@li... <mailto:Web...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> Dive into the World of Parallel Programming. The Go Parallel Website, >>>> >>>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>>> >>>> hub for all things parallel software development, from weekly thought >>>> >>>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>>> >>>> look and join the conversation now.http://goparallel.sourceforge.net/ >>>> >>>> _______________________________________________ >>>> >>>> Web-erp-developers mailing list >>>> >>>> Web...@li... <mailto:Web...@li...> >>>> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> No virus found in this message. >>>> Checked by AVG - www.avg.com >>>> <http://www.avg.com> >>>> Version: 2015.0.5646 / Virus Database: >>>> 4284/9096 - Release Date: 02/11/15 >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel >>>> Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in >>>> partnership with Slashdot Media, is your >>>> hub for all things parallel software >>>> development, from weekly thought >>>> leadership blogs to news, videos, case >>>> studies, tutorials and more. Take a >>>> look and join the conversation now. >>>> http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Web-erp-developers mailing list >>>> Web...@li... >>>> <mailto:Web...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel >>>> Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in >>>> partnership with Slashdot Media, is your >>>> hub for all things parallel software >>>> development, from weekly thought >>>> leadership blogs to news, videos, case >>>> studies, tutorials and more. Take a >>>> look and join the conversation now. >>>> http://goparallel.sourceforge.net/ >>>> <http://goparallel.sourceforge.net/> >>>> _______________________________________________ >>>> Web-erp-developers mailing list >>>> Web...@li... >>>> <mailto:Web...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel >>>> Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in >>>> partnership with Slashdot Media, is your >>>> hub for all things parallel software >>>> development, from weekly thought >>>> leadership blogs to news, videos, case >>>> studies, tutorials and more. Take a >>>> look and join the conversation now. >>>> http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Web-erp-developers mailing list >>>> Web...@li... >>>> <mailto:Web...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>>> hub for all things parallel software development, from weekly thought >>>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>>> >>>> >>>> >>>> look and join the conversation now.http://goparallel.sourceforge.net/ >>>> >>>> >>>> _______________________________________________ >>>> Web-erp-developers mailing list >>>> Web...@li... <mailto:Web...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>>> No virus found in this message. >>>> Checked by AVG - www.avg.com <http://www.avg.com> >>>> Version: 2015.0.5646 / Virus Database: 4284/9102 - >>>> Release Date: 02/12/15 >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go >>> Parallel Website, >>> sponsored by Intel and developed in partnership with >>> Slashdot Media, is your >>> hub for all things parallel software development, >>> from weekly thought >>> leadership blogs to news, videos, case studies, >>> tutorials and more. Take a >>> look and join the conversation now. >>> http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go >>> Parallel Website, >>> sponsored by Intel and developed in partnership with >>> Slashdot Media, is your >>> hub for all things parallel software development, from >>> weekly thought >>> leadership blogs to news, videos, case studies, >>> tutorials and more. Take a >>> look and join the conversation now. >>> http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> -- >>> Course View Towers, >>> Plot 21 Yusuf Lule Road, >>> Kampala >>> T +256 (0) 312 314 418 >>> M +256 (0) 752 963 325 >>> www.weberpafrica.com <http://www.weberpafrica.com> >>> Twitter: @TimSchofield2 >>> Blog: http://weberpafrica.blogspot.co.uk/ >>> No virus found in this message. >>> Checked by AVG - www.avg.com <http://www.avg.com> >>> Version: 2015.0.5646 / Virus Database: 4284/9112 - Release >>> Date: 02/14/15 >> >> >> >> >> -- >> Course View Towers, >> Plot 21 Yusuf Lule Road, >> Kampala >> T +256 (0) 312 314 418 >> M +256 (0) 752 963 325 >> www.weberpafrica.com <http://www.weberpafrica.com> >> Twitter: @TimSchofield2 >> Blog: http://weberpafrica.blogspot.co.uk/ >> >> No virus found in this message. >> Checked by AVG - www.avg.com <http://www.avg.com> >> Version: 2015.0.5646 / Virus Database: 4284/9120 - Release Date: >> 02/15/15 >> > > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 2015.0.5646 / Virus Database: 4284/9126 - Release Date: 02/16/15 > > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > > > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Rafael C. <raf...@gm...> - 2016-04-07 15:15:54
|
Hi Ricard, I am looking for (as it is reasonable possible) to reduce, simplify and "streamline" the included code. Example, "barcodepack" and "tcpdf" both print barcodes (but it need tests, as you do). Also, Gettext is included in some php installations (but not in all, so it is NOT possible to remove ~/includes/php-gettext). Yes, I will be glad to receive your code. Although it was very customized, the ideas can be reused. Note: I only use EAN-13 (so I can not help you too much). But see function write1DBarcode() in ~/includes/tcpdf/tcpdf.php line 15286. Hi ExsonQu, Today, I included some documentation on ~/includes/class.pdf.php. I hope that helps you. Best regards, Rafael. 2016-04-04 4:11 GMT-06:00 ExsonQu <hex...@gm...>: > *Hi, Rafael,* > > Thank you for your explain! > > I'll check it later. > > Thanks and best regards! > > Exson > > > > -- > View this message in context: > http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658575.html > Sent from the web-ERP-developers mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: ExsonQu <hex...@gm...> - 2016-07-09 03:30:44
|
*Hi, Rafael,* Thank you for your documentation. Since some parts of those pdf files not display Chinese characters properly, I've reviewed all your post and they give me lots of help. I've found that mb_substr() function missed encoding in addTextWrap() function. It's fixed now and hope it also make some improvements for the utf8 code separation. Thanks again! Exson -- View this message in context: http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658633.html Sent from the web-ERP-developers mailing list archive at Nabble.com. |
From: Rafael C. <raf...@gm...> - 2016-07-25 14:58:42
|
Hi Exson. Sorry by the delay. You are welcome. I think at a certain time we can dispense with the use of ~/includes/class.pdf.php. The class.pdf.php is an intermediary between R&OS_pdf.php_class (how functions were written inside webERP) and ~/includes/tcpdf/tcpdf.php (the actually used functions in webERP). Nicola Asuni released a new version of TCPDF; unfortunately something inside webRP causes a bug with the new version. I begun to replace addJpegFromFile() [from R&OS pdf.php] with Image() [from tcpdf.php]. Best regards, Rafael. 2016-07-08 20:48 GMT-06:00 ExsonQu <hex...@gm...>: > *Hi, Rafael,* > > Thank you for your documentation. > Since some parts of those pdf files not display Chinese > characters properly, I've reviewed all your post and they give me lots of > help. > I've found that mb_substr() function missed encoding in > addTextWrap() function. It's fixed now and hope it also make some > improvements for the utf8 code separation. > > Thanks again! > > Exson > > > > -- > View this message in context: > http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658633.html > Sent from the web-ERP-developers mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: Phil D. <ph...@lo...> - 2016-07-26 06:39:04
|
Yes ... I would prefer we didn't have includes/class.pdf.php and used the native TCPDF functions directly... it is just that it is now a LOT of work to change all the existing reports to use them. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 26/07/16 02:58, Rafael Chacón wrote: > Hi Exson. > > Sorry by the delay. You are welcome. > > I think at a certain time we can dispense with the use of > ~/includes/class.pdf.php. The class.pdf.php is an intermediary > between R&OS_pdf.php_class (how functions were written inside webERP) > and ~/includes/tcpdf/tcpdf.php (the actually used functions in > webERP). Nicola Asuni released a new version > of TCPDF; unfortunately something inside webRP causes a bug with the > new version. > > I begun to replace addJpegFromFile() [from R&OS pdf.php] with Image() > [from tcpdf.php]. > > Best regards, Rafael. > > > 2016-07-08 20:48 GMT-06:00 ExsonQu <hex...@gm... > <mailto:hex...@gm...>>: > > *Hi, Rafael,* > > Thank you for your documentation. > Since some parts of those pdf files not display > Chinese > characters properly, I've reviewed all your post and they give me > lots of > help. > I've found that mb_substr() function missed > encoding in > addTextWrap() function. It's fixed now and hope it also make some > improvements for the utf8 code separation. > > Thanks again! > > Exson > > > > -- > View this message in context: > http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658633.html > Sent from the web-ERP-developers mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park > in San > Francisco, CA to explore cutting-edge tech and listen to tech > luminaries > present their vision of the future. This family event has > something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity planning > reports.http://sdm.link/zohodev2dev > > > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Rafael C. <raf...@gm...> - 2016-04-03 16:32:42
|
Hi Exson: Sorry by the delay, I was reviewing my notes. To replace addTextWrap() and AddText() with Nicola Asuni TCPDF' functions, there are some options. I did the following (I do not know if it is the best, because I did it in a rush): addText($XPos,$YPos,$size,$text) ----------- I use public function: Text($x, $y, $txt, $fstroke=false, $fclip=false, $ffill=true, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false). Parameters: * $x (float) Abscissa of the cell origin (same as addText_$XPos). MUST. * $y (float) Ordinate of the cell origin (cell vertical coordinate from page TOP side to cell top side in dpi -72dpi = 25.4mm-. WARNING: $y = page_height – addText_$YPos). MUST. * $txt (string) String to print (same as addText_$text). MUST. To change font size, you have to use public function SetFontSize() in tcpdf/tcpdf.php. Example: $this->SetFontSize($size); $this->Text($XPos, $this->h-$YPos, $text); More info: In tcpdf/tcpdf.php, line 4870. See also: Cell(), Write(), MultiCell(), WriteHTML(), WriteHTMLCell(). addTextWrap($XPos, $YPos, $linewidth, $fontsize, $text, $Align='left', $angle=0, $test=0, $border=0, $fill=false) ------------------ I use public function: MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false). Probably it is better to use the function writeHTMLCell (see: http://www.tcpdf.org/examples/example_046.phps, a text hyphenation example). This function can be used also to replace AddText(), but it is more complex. Parameters: * $w (float) Width of cells. If 0, they extend up to the right margin of the page (same as addTextWrap_$linewidth). MUST. * $h (float) Cell minimum height. The cell extends automatically if needed (I use the same as addTextWrap_$fontsize, but I saw some reports that use a greater line_height). MUST. * $txt (string) String to print [same as addTextWrap_$text, but you must translate it to html using, as example, “html_entity_decode($text, ENT_QUOTES, 'UTF-8')” ]. MUST. * $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number: 0: no border (default); 1: frame; or a string containing some or all of the following characters (in any order): L: left; T: top; R: right; B: bottom; or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))). OPTIONAL, I recommend to input as “$border=0”. * $align (string) Allows to centre or align the text. Possible values are: L or empty string: left align; C: centre; R: right align; J: justification (default value when $ishtml=false). OPTIONAL, I do a “switch($Align) {// Translate from Pdf-Creator to TCPDF.”. * $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). OPTIONAL, I recommend to input as “$fill=false”. * $ln (int) Indicates where the current position should go after the call. Possible values are: 0: to the right; 1: to the beginning of the next line [DEFAULT]; 2: below. OPTIONAL, I recommend to input as “$ln=1” to use the return_function to control the position at the printing end. * $x (float) x position in user units (same as addTextWrap_$XPos). OPTIONAL, but I recommend to use it. * $y (float) y position in user units (cell vertical coordinate from page TOP side to cell top side in dpi -72dpi = 25.4mm-. WARNING_1: $y = page_height – addTextWrap_$YPos – addTextWrap_$lineheight. WARNING_2: This addTextWrap_$lineheight = addTextWrap_$fontsize is the difference in y_pos between addTextWrap() and AddText(). OPTIONAL, but I recommend to use it. To change font size, you have to use public function SetFontSize() in tcpdf/tcpdf.php. Example: $this->SetFontSize($size); $this->MultiCell($linewidth, $fontsize, html_entity_decode($text, ENT_QUOTES, 'UTF-8'), $border, $Align, $fill, 1, $XPos, $this->h - $Ypos);// Using $Ypos as in AddText(). // return $this->h - $this->y;// The position after printing. COMMENT: $YPos is the same as in addText(). More info: In tcpdf/tcpdf.php, line 5732. See also: SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak(). Comments -------------- * For a quick transition, I included a new function in includes/class.pdf: //------------------------------------------------------------------------------ public function TextWrap($XPos, $YPos, $linewidth, $fontsize, $text, $Align='left', $border=0, $fill=false) { // Adds text to the page, but ensure that it fits within a certain width. If it does not fit then put in as much as possible, splitting at white space or soft hyphen character and return the remainder. Justification can also be specified for the text. It use UTF-8 encoding. // $XPos = Cell horizontal coordinate from page left side to cell left side in dpi (72dpi = 25.4mm). // $YPos = Cell vertical coordinate from page bottom side to cell top side in dpi (72dpi = 25.4mm). // $linewidth = Cell (line) width in dpi (72dpi = 25.4mm). If 0, MultiCell() extends up to the right margin of the page. // $fontsize = Font size in dpi (72dpi = 25.4mm). // $text = Text to be split in portion to be add to the page and the remainder to be returned. // $Align = 'left', 'center', 'centre', 'full' or 'right'. // $border = Indicates if borders must be drawn around the cell. The value can be a number: 0: no border (default), 1: frame, or a string containing some or all of the following characters (in any order): L: left, T: top, R: right, B: bottom or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))). // $fill = Indicates if the cell background must be painted (true) or transparent (false). // @access public. $this->SetFontSize($fontsize);// Public function SetFontSize() in ~/includes/tcpdf/tcpdf.php. $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');// Convert all HTML entities to their applicable characters. switch($Align) {// Translate from Pdf-Creator to TCPDF. case 'left': $Align = 'L'; break; case 'right': $Align = 'R'; break; case 'center': $Align = 'C'; break; case 'centre': $Align = 'C'; break; case 'full': $Align = 'J'; break; default: $Align = 'L'; break; } $this->MultiCell($linewidth, $fontsize, $text, $border, $Align, $fill, 1, $XPos, $this->h - $YPos);// Public function SetFontSize() in ~/includes/tcpdf/tcpdf.php. return $this->h - $this->y;// COMMENT: $YPos is the same as in addText(). } //------------------------------------------------------------------------------ * Note: I am also thinking in migrate from barcodepack to Nicola Asuni TCPDF' barcode_functions. Best regards, Rafael. 2016-04-01 18:28 GMT-06:00 ExsonQu <hex...@gm...>: > *Hi, Rafael,* > > Thank you for your reply. > It is a good idea to migrate tcpdf absolutely. But the problem is > that without addTextWrap, it's hard to control the Xpos and Ypos for > multiple lines cell. Do you have any solution for this? > > Thanks and best regards! > > Exson > > > > -- > View this message in context: > http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658572.html > Sent from the web-ERP-developers mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: Pak R. <pak...@gm...> - 2016-04-04 09:37:43
|
Hi Rafael: 2 months ago I had to use TCPDF to print barcode labels as the current webERP library was not precise enough for our needs (we must specify the width of the smallest vertical bar). I'm not an expert (al all) in PDF creation and was quite trial and error, but ended up with a simple code to read and maintain. I found really simple t use the "space management" space we have for printing purposes, when to add a page, etc) so I guess we'll end up with shorter code doing neater things. I will be happy to forward you the script (was too customized to be of any use for the community), but maybe it can help you with some portions of reusable code for the barcode part, If you think it can help, just let me know and I'mm forward to you. Many thanks for keep updating webERP in this field, which is much more tricky than it looks. Regards, Ricard 2016-04-04 0:32 GMT+08:00 Rafael Chacón <raf...@gm...>: > Hi Exson: > > Sorry by the delay, I was reviewing my notes. > To replace addTextWrap() and AddText() with Nicola Asuni TCPDF' functions, > there are some options. I did the following (I do not know if it is the > best, because I did it in a rush): > > addText($XPos,$YPos,$size,$text) > ----------- > I use public function: > Text($x, $y, $txt, $fstroke=false, $fclip=false, $ffill=true, $border=0, > $ln=0, $align='', $fill=false, $link='', $stretch=0, > $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false). > Parameters: > * $x (float) Abscissa of the cell origin (same as addText_$XPos). MUST. > * $y (float) Ordinate of the cell origin (cell vertical coordinate from > page TOP side to cell top side in dpi -72dpi = 25.4mm-. WARNING: $y = > page_height – addText_$YPos). MUST. > * $txt (string) String to print (same as addText_$text). MUST. > To change font size, you have to use public function SetFontSize() in > tcpdf/tcpdf.php. > Example: > $this->SetFontSize($size); > $this->Text($XPos, $this->h-$YPos, $text); > More info: In tcpdf/tcpdf.php, line 4870. > See also: Cell(), Write(), MultiCell(), WriteHTML(), WriteHTMLCell(). > > addTextWrap($XPos, $YPos, $linewidth, $fontsize, $text, $Align='left', > $angle=0, $test=0, $border=0, $fill=false) > ------------------ > I use public function: > MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', > $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, > $valign='T', $fitcell=false). > Probably it is better to use the function writeHTMLCell (see: > http://www.tcpdf.org/examples/example_046.phps, a text hyphenation > example). This function can be used also to replace AddText(), but it is > more complex. > Parameters: > * $w (float) Width of cells. If 0, they extend up to the right margin of > the page (same as addTextWrap_$linewidth). MUST. > * $h (float) Cell minimum height. The cell extends automatically if needed > (I use the same as addTextWrap_$fontsize, but I saw some reports that use a > greater line_height). MUST. > * $txt (string) String to print [same as addTextWrap_$text, but you must > translate it to html using, as example, “html_entity_decode($text, > ENT_QUOTES, 'UTF-8')” ]. MUST. > * $border (mixed) Indicates if borders must be drawn around the cell. The > value can be a number: 0: no border (default); 1: frame; or a string > containing some or all of the following characters (in any order): L: left; > T: top; R: right; B: bottom; or an array of line styles for each border > group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', > 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))). OPTIONAL, I > recommend to input as “$border=0”. > * $align (string) Allows to centre or align the text. Possible values are: > L or empty string: left align; C: centre; R: right align; J: justification > (default value when $ishtml=false). OPTIONAL, I do a “switch($Align) {// > Translate from Pdf-Creator to TCPDF.”. > * $fill (boolean) Indicates if the cell background must be painted (true) > or transparent (false). OPTIONAL, I recommend to input as “$fill=false”. > * $ln (int) Indicates where the current position should go after the call. > Possible values are: 0: to the right; 1: to the beginning of the next line > [DEFAULT]; 2: below. OPTIONAL, I recommend to input as “$ln=1” to use the > return_function to control the position at the printing end. > * $x (float) x position in user units (same as addTextWrap_$XPos). > OPTIONAL, but I recommend to use it. > * $y (float) y position in user units (cell vertical coordinate from page > TOP side to cell top side in dpi -72dpi = 25.4mm-. WARNING_1: $y = > page_height – addTextWrap_$YPos – addTextWrap_$lineheight. WARNING_2: This > addTextWrap_$lineheight = addTextWrap_$fontsize is the difference in y_pos > between addTextWrap() and AddText(). OPTIONAL, but I recommend to use it. > To change font size, you have to use public function SetFontSize() in > tcpdf/tcpdf.php. > Example: > $this->SetFontSize($size); > $this->MultiCell($linewidth, $fontsize, html_entity_decode($text, > ENT_QUOTES, 'UTF-8'), $border, $Align, $fill, 1, $XPos, $this->h - > $Ypos);// Using $Ypos as in AddText(). > // return $this->h - $this->y;// The position after printing. COMMENT: > $YPos is the same as in addText(). > More info: In tcpdf/tcpdf.php, line 5732. > See also: SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), > SetLineWidth(), Cell(), Write(), SetAutoPageBreak(). > > Comments > -------------- > * For a quick transition, I included a new function in includes/class.pdf: > > //------------------------------------------------------------------------------ > public function TextWrap($XPos, $YPos, $linewidth, $fontsize, $text, > $Align='left', $border=0, $fill=false) { > // Adds text to the page, but ensure that it fits within a certain width. > If it does not fit then put in as much as possible, splitting at white > space or soft hyphen character and return the remainder. Justification can > also be specified for the text. It use UTF-8 encoding. > // $XPos = Cell horizontal coordinate from page left side to cell left > side in dpi (72dpi = 25.4mm). > // $YPos = Cell vertical coordinate from page bottom side to cell top side > in dpi (72dpi = 25.4mm). > // $linewidth = Cell (line) width in dpi (72dpi = 25.4mm). If 0, > MultiCell() extends up to the right margin of the page. > // $fontsize = Font size in dpi (72dpi = 25.4mm). > // $text = Text to be split in portion to be add to the page and the > remainder to be returned. > // $Align = 'left', 'center', 'centre', 'full' or 'right'. > // $border = Indicates if borders must be drawn around the cell. The value > can be a number: 0: no border (default), 1: frame, or a string containing > some or all of the following characters (in any order): L: left, T: top, R: > right, B: bottom or an array of line styles for each border group - for > example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => > 'miter', 'dash' => 0, 'color' => array(0, 0, 0))). > // $fill = Indicates if the cell background must be painted (true) or > transparent (false). > // @access public. > $this->SetFontSize($fontsize);// Public function SetFontSize() in > ~/includes/tcpdf/tcpdf.php. > $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');// Convert all HTML > entities to their applicable characters. > switch($Align) {// Translate from Pdf-Creator to TCPDF. > case 'left': > $Align = 'L'; break; > case 'right': > $Align = 'R'; break; > case 'center': > $Align = 'C'; break; > case 'centre': > $Align = 'C'; break; > case 'full': > $Align = 'J'; break; > default: > $Align = 'L'; break; > } > $this->MultiCell($linewidth, $fontsize, $text, $border, $Align, $fill, 1, > $XPos, $this->h - $YPos);// Public function SetFontSize() in > ~/includes/tcpdf/tcpdf.php. > return $this->h - $this->y;// COMMENT: $YPos is the same as in addText(). > } > > //------------------------------------------------------------------------------ > > * Note: I am also thinking in migrate from barcodepack to Nicola Asuni > TCPDF' barcode_functions. > > Best regards, Rafael. > > 2016-04-01 18:28 GMT-06:00 ExsonQu <hex...@gm...>: > >> *Hi, Rafael,* >> >> Thank you for your reply. >> It is a good idea to migrate tcpdf absolutely. But the problem >> is >> that without addTextWrap, it's hard to control the Xpos and Ypos for >> multiple lines cell. Do you have any solution for this? >> >> Thanks and best regards! >> >> Exson >> >> >> >> -- >> View this message in context: >> http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658572.html >> Sent from the web-ERP-developers mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> Transform Data into Opportunity. >> Accelerate data analysis in your applications with >> Intel Data Analytics Acceleration Library. >> Click to learn more. >> http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> > > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |
From: ExsonQu <hex...@gm...> - 2016-04-04 10:42:26
|
*Hi, Rafael,* Thank you for your explain! I'll check it later. Thanks and best regards! Exson -- View this message in context: http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658575.html Sent from the web-ERP-developers mailing list archive at Nabble.com. |
From: Rafael C. <raf...@gm...> - 2016-04-01 00:08:26
|
Hi, No, the old addTextWrap is NOT reliable. The old version uses deprecated PHP functions. In my installation I use a corrected version of "class.pdf.php" (this version can not be upload to the trunk because of incompatibilities with user's form --I don not remember if Andrew Galuski had documented those troubles--). It is better to completely move to Nicola Asuni 's TCPDF: reliable, safety, and more functionalities (you can direct convert a html to pdf; Text() function and other functions can replace addTextWrap with text hyphenation, internationalization, etc.). THE PROBLEM: if you update the TCPDF version in webERP with the TCPDF current version, you will have errors (somewhere, something is different --a parameter missing?--). Differences between addTextWrap() and AddText(): addTextWrap() can handle multiples lines; AddText() only can handle one line. Also, the distance from the bottom-left corner are measured in different ways (WARNING!: there are not equal). I have to review my documentation about this matter. But by my memory, this is that I remember. Best regards, Rafael. ---------- 2016-03-31 17:07 GMT-06:00 ExsonQu <hex...@gm...>: > *Hi, all,* > > Is addTextWrap is reliable? > > I've received several reports about the failure about this. It > seems we have to change this one to AddText(), but it is difficult to > handle > the text position. > > Thanks and best regards! > > Exson > > > > > -- > View this message in context: > http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658570.html > Sent from the web-ERP-developers mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: ExsonQu <hex...@gm...> - 2016-04-02 00:58:54
|
*Hi, Rafael,* Thank you for your reply. It is a good idea to migrate tcpdf absolutely. But the problem is that without addTextWrap, it's hard to control the Xpos and Ypos for multiple lines cell. Do you have any solution for this? Thanks and best regards! Exson -- View this message in context: http://weberp-accounting.1478800.n4.nabble.com/PDF-generator-in-webERP-tp4658061p4658572.html Sent from the web-ERP-developers mailing list archive at Nabble.com. |
From: Vitaly S. <vsh...@so...> - 2015-02-12 19:46:01
|
Rafael, Your function looks much more readable than the original. I also like that it does splitting on the "\n" instead of relying on some external code to do that. I will try it on my test system to see how much it will affect various forms. So far I noticed that sometimes a text, pasted from the text editor, may have \r\n encoded as a text. It looks like that in PDF line1\r\nline2\r\n instead of line1 line2 I would like to add this to you function to cover all possible line ending combinations $text = str_replace('\r','',$text); // single quotes - no string parsing in PHP $text = str_replace('\n',"\n",$text); // replace '\n' text with new line character Regards, Vitaly On 2/11/2015 4:44 PM, Rafael Chacón wrote: > Hi Andrew, > > I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace > AddTextWrap lines (80-169) with lines 3-66 of the included file. > > Comments: > * I'm testing with last version of Nicola Asuni's TCPDF. > * It is possible to replace line 56 ("$textwidth += > $this->GetStringWidth($c);") with two lines. Those two lines makes the > function a little faster in some cases ($text width near the cell > width), but slower in other cases ($text width far from the cell width). > > Best regards, Rafael. > > 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re... > <mailto:aga...@re...>>: > > I am trouble shooting the same problem today where it wraps text > smaller than the width. The added $s = trim($s).' ';" causes an > issue for me. Or you can change a do while loop from < to <= $nb > and it appears to fix same issue. My worry was testing all > existing forms. If you can send me your update I will test it in > my environment for all my forms. > > Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G > LTE network. > *From: *Rafael Chacón > *Sent: *Wednesday, February 11, 2015 3:26 PM > *To: *webERP Developers > *Reply To: *webERP Developers > *Subject: *Re: [WebERP-developers] PDF generator in webERP. > > > Hi Vitaly, > > Thank you for writing. > > About > "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": > This line returns an array of strings, each of which is a > substring of $myrow2['narrative'] formed by splitting it on > boundaries formed by the characters Carriage_Return ("\r") and > Line_Feed ("\n"). It only works for msWindows (Unix-like and Mac > OS-10 use Line_Feed; Mac OS up to version 9 uses Carriage_Return). > > The problem in PrintCustTransPortrait.php (and other reports) is > caused by two bugs in AddTextWarp(): > > 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the > extra white line). > 2. Lines from 106 to 164: (the logic of the code -> splitting in > the last white_space of a segment smaller that the cell width). > > My purpose in asking if someone "has problem with this function > (last line line-feeded before the end) ?" is know who else > experiences that problem. > > I have a new AddTextWrap that fixes both bugs. It is faster and > produces PDF files with a slightly smaller size, but --obviously-- > it not produce the extra blank line in segments smaller than cell > width. Many users like this (no extra blank line) but there are > some users who ask me to re-do this extra blank line. > > I would like other people tests this new AddTextWrap. Although > this extra blank line is a bug, I am not comfortable with the idea > of a potential change in actual reports. > > Best regards, Rafael. > > > 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov > <vsh...@so... <mailto:vsh...@so...>>: > > Rafael, > > The addTextWrap() does not split the line like that. It is > done by this function > $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); > > in PrintCustTransPortrait.php > > > Vitaly > > > On 2/10/2015 9:38 PM, Rafael Chacón wrote: >> HI Phil, >> >> Thank you for your answer. >> >> Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf >> development, I think it will be better to directly use TCPDF: >> (a) Y-coordinate= instead of calculating as from page-bottom >> to cell-bottom and the script class.pdf.php translates to >> page-top to cell-top to use tcpdf.php, we can directly use >> page-top to cell-top and TCPDF; (b) TCPDF has interesting >> functions (writeHTML, writeHTMLCell, etc.) to write code html >> (a screen report) into a pdf. >> >> Topic 2: tcpdf 6.2.6 has new fonts and others.They may be >> helpful to give more options to reports. >> >> Topic 3: With PrintCustTransPortrait.php (and other reports) >> I have unexpected breaks (see enclose) and prints lines with >> whitespace. The problems are inside AddTextWarp(). >> >> Regards, Rafael. >> >> >> 2015-02-09 22:34 GMT-06:00 Phil Daintree >> <ph...@lo... <mailto:ph...@lo...>>: >> >> Yes originally used R & OS pdf library. >> Moved to Oliver Plathey FPDF http://www.fpdf.org/ >> The class.pdf.php was created to allow the transition to FPDF >> ... then to TCPDF which was a development of FPDF which >> allowed utf-8 pdfs - using CID fonts rather than >> embedding a large monster font file into each pdf - so a >> small 10k report becomes 2 Meg. This was not considered >> acceptable. >> I update tcpdf from time to time. >> >> Not sure about 3. >> >> Phil >> >> Phil Daintree >> Logic Works Ltd - +64 (0)275 567890 >> http://www.logicworks.co.nz >> >> On 10/02/15 13:37, Rafael Chacón wrote: >>> Hi, >>> >>> Some questions: >>> >>> 1. webERP begun using PHP Pdf creation - R&OS >>> (http://sourceforge.net/projects/pdf-php/). Then, webERP >>> moved to TCPDF (http://www.tcpdf.org/). Javier de >>> Lorenzo-Cáceres wrote ~/includes/class.pdf.php to use >>> TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old code). >>> Is it right? >>> >>> 2. Someone has updated the ~/includes/tcpdf folder with >>> TCPDF version 6.2.6 ? >>> >>> 3. Someone has replaced the function AddTextWarp() or >>> has problem with this function (last line line-feeded >>> before the end) ? >>> >>> Best regards, Rafael. >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> look and join the conversation now.http://goparallel.sourceforge.net/ >>> >>> >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... <mailto:Web...@li...> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go >> Parallel Website, >> sponsored by Intel and developed in partnership with >> Slashdot Media, is your >> hub for all things parallel software development, from >> weekly thought >> leadership blogs to news, videos, case studies, tutorials >> and more. Take a >> look and join the conversation now. >> http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> <mailto:Web...@li...> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now.http://goparallel.sourceforge.net/ >> >> >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... <mailto:Web...@li...> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> No virus found in this message. >> Checked by AVG - www.avg.com <http://www.avg.com> >> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release >> Date: 02/11/15 >> > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel > Website, > sponsored by Intel and developed in partnership with Slashdot > Media, is your > hub for all things parallel software development, from weekly > thought > leadership blogs to news, videos, case studies, tutorials and > more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/ > <http://goparallel.sourceforge.net/> > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot > Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and > more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > > > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 2015.0.5646 / Virus Database: 4284/9102 - Release Date: 02/12/15 > |
From: Rafael C. <raf...@gm...> - 2015-02-12 22:02:26
|
Hi Vitaly, Thank you very much for you contribution. I will add your lines to the function before send the update. Also, I will add: * "Greater/Less than or equal to" comparisons instead of "Greater/Less than" to cover the possibility of exact matches (even character width are calculated at the level of 1/1000 dpi). * The use of soft-hyphen instead of hard-hyphen as break points. * Other contributions. The problem that you points out, also occurs when null, line-feed, carriage-return, back-slash, single-quote, double-quotes, and control-Z are escaped. This occurs when we use functions like mysqli_real_escape_string() --e.g. inside of function DB_escape_string()--. It is pending: * The use of curly braces {} to access characters in a string. Some PHP's documents say that this syntax is deprecated, but other do not (ref: php.net/manual/de/language.types.string.php vs. php.net/manual/en/language.types.string.php). Also, we have concerns about how multi-byte safe is. Best regards, Rafael. 2015-02-12 13:45 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: > Rafael, > > Your function looks much more readable than the original. I also like that > it does splitting on the "\n" instead of relying on some external code to > do that. > I will try it on my test system to see how much it will affect various > forms. > > So far I noticed that sometimes a text, pasted from the text editor, may > have \r\n encoded as a text. It looks like that in PDF > line1\r\nline2\r\n > instead of > line1 > line2 > > I would like to add this to you function to cover all possible line ending > combinations > > $text = str_replace('\r','',$text); // single quotes - no string parsing > in PHP > $text = str_replace('\n',"\n",$text); // replace '\n' text with new line > character > > Regards, > > Vitaly > > > On 2/11/2015 4:44 PM, Rafael Chacón wrote: > > Hi Andrew, > > I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace > AddTextWrap lines (80-169) with lines 3-66 of the included file. > > Comments: > * I'm testing with last version of Nicola Asuni's TCPDF. > * It is possible to replace line 56 ("$textwidth += > $this->GetStringWidth($c);") with two lines. Those two lines makes the > function a little faster in some cases ($text width near the cell width), > but slower in other cases ($text width far from the cell width). > > Best regards, Rafael. > > 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...>: > >> I am trouble shooting the same problem today where it wraps text >> smaller than the width. The added $s = trim($s).' ';" causes an issue >> for me. Or you can change a do while loop from < to <= $nb and it appears >> to fix same issue. My worry was testing all existing forms. If you can send >> me your update I will test it in my environment for all my forms. >> >> Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE >> network. >> *From: *Rafael Chacón >> *Sent: *Wednesday, February 11, 2015 3:26 PM >> *To: *webERP Developers >> *Reply To: *webERP Developers >> *Subject: *Re: [WebERP-developers] PDF generator in webERP. >> >> Hi Vitaly, >> >> Thank you for writing. >> >> About >> "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": >> This line returns an array of strings, each of which is a substring of >> $myrow2['narrative'] formed by splitting it on boundaries formed by the >> characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for >> msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 >> uses Carriage_Return). >> >> The problem in PrintCustTransPortrait.php (and other reports) is caused >> by two bugs in AddTextWarp(): >> >> 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra >> white line). >> 2. Lines from 106 to 164: (the logic of the code -> splitting in the last >> white_space of a segment smaller that the cell width). >> >> My purpose in asking if someone "has problem with this function (last >> line line-feeded before the end) ?" is know who else experiences that >> problem. >> >> I have a new AddTextWrap that fixes both bugs. It is faster and produces >> PDF files with a slightly smaller size, but --obviously-- it not produce >> the extra blank line in segments smaller than cell width. Many users like >> this (no extra blank line) but there are some users who ask me to re-do >> this extra blank line. >> >> I would like other people tests this new AddTextWrap. Although this extra >> blank line is a bug, I am not comfortable with the idea of a potential >> change in actual reports. >> >> Best regards, Rafael. >> >> >> 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: >> >>> Rafael, >>> >>> The addTextWrap() does not split the line like that. It is done by this >>> function >>> $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); >>> >>> in PrintCustTransPortrait.php >>> >>> >>> Vitaly >>> >>> >>> On 2/10/2015 9:38 PM, Rafael Chacón wrote: >>> >>> HI Phil, >>> >>> Thank you for your answer. >>> >>> Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think >>> it will be better to directly use TCPDF: (a) Y-coordinate= instead of >>> calculating as from page-bottom to cell-bottom and the script class.pdf.php >>> translates to page-top to cell-top to use tcpdf.php, we can directly use >>> page-top to cell-top and TCPDF; (b) TCPDF has interesting functions >>> (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into >>> a pdf. >>> >>> Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to >>> give more options to reports. >>> >>> Topic 3: With PrintCustTransPortrait.php (and other reports) I have >>> unexpected breaks (see enclose) and prints lines with whitespace. The >>> problems are inside AddTextWarp(). >>> >>> Regards, Rafael. >>> >>> >>> 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...>: >>> >>>> Yes originally used R & OS pdf library. >>>> Moved to Oliver Plathey FPDF http://www.fpdf.org/ >>>> The class.pdf.php was created to allow the transition to FPDF >>>> ... then to TCPDF which was a development of FPDF which allowed utf-8 >>>> pdfs - using CID fonts rather than embedding a large monster font file into >>>> each pdf - so a small 10k report becomes 2 Meg. This was not considered >>>> acceptable. >>>> I update tcpdf from time to time. >>>> >>>> Not sure about 3. >>>> >>>> Phil >>>> >>>> Phil Daintree >>>> Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz >>>> >>>> On 10/02/15 13:37, Rafael Chacón wrote: >>>> >>>> Hi, >>>> >>>> Some questions: >>>> >>>> 1. webERP begun using PHP Pdf creation - R&OS ( >>>> http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF >>>> (http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote >>>> ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" >>>> (old code). Is it right? >>>> >>>> 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version >>>> 6.2.6 ? >>>> >>>> 3. Someone has replaced the function AddTextWarp() or has problem with >>>> this function (last line line-feeded before the end) ? >>>> >>>> Best regards, Rafael. >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>>> hub for all things parallel software development, from weekly thought >>>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>>> look and join the conversation now. http://goparallel.sourceforge.net/ >>>> >>>> >>>> >>>> _______________________________________________ >>>> Web-erp-developers mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming. The Go Parallel Website, >>>> sponsored by Intel and developed in partnership with Slashdot Media, is >>>> your >>>> hub for all things parallel software development, from weekly thought >>>> leadership blogs to news, videos, case studies, tutorials and more. >>>> Take a >>>> look and join the conversation now. http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Web-erp-developers mailing list >>>> Web...@li... >>>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> >>> >>> >>> _______________________________________________ >>> Web-erp-developers mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> No virus found in this message. >>> Checked by AVG - www.avg.com >>> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is >>> your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take >>> a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming. The Go Parallel Website, >> sponsored by Intel and developed in partnership with Slashdot Media, is >> your >> hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials and more. Take a >> look and join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > Web-erp-developers mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2015.0.5646 / Virus Database: 4284/9102 - Release Date: 02/12/15 > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |
From: Vitaly S. <vsh...@so...> - 2015-02-14 03:05:23
|
Hi Rafael, I applied your updated function to my code and started testing. So far I like it very much. I does everything that I expected that function to do in the first place. I found some problems in some of my forms, but not too many. All of them due to my hacking, trying to get that function to do what it was not doing before. The only change I would make is to put the $fill parameter back. It is a very useful feature for me. Thank you very much Vitaly On 2/13/2015 2:14 PM, Rafael Chacón wrote: > Hi Andrew, > > Sorry, just I read you messages. > > Yes, as I said in previous messages, this new AddTextWrap fixes the > extra blank line bug. But if any user like this extra blank line bug, > there is lot of work adding a extra line to reports. > > About the problem with your text: > > I think the text does not wrap because it is using a non-breaking > space character instead of a white space character. > > A possible fix: > > $nbsp = html_entity_decode(' ', ENT_QUOTES, 'UTF-8');// Converts > non-breaking space HTML entity to their applicable character. > $text = str_replace($nbsp,' ',$text); > > Best regards, Rafael. > > 2015-02-13 13:53 GMT-06:00 Rafael Chacón > <raf...@gm... <mailto:raf...@gm...>>: > > Hi, > > I enclose a uptdate to new addTextWrap. > > Changes: > 1. Sets encoding 'UTF-8' in all multi-byte functions. > 2. Adds the replace of '\n' text with a line feed character. This > is to fix the possible introduction of a '\n' text instead of a > line feed character. > 3. Adds the delete of '\r' text. This is to fix the possible > introduction of a '\r' text instead of a carriage return character. > 4. Replaces hard hypen with soft hyphen as possible break position. > 5. Privileges the use of mb_substr() instead of $text{$i} > (deprecated? not multi-byte safe?) and $text[$i] (not multi-byte > safe?). > 6. Uses "greater than or equal to" comparison instead of "greater > than" to cover the possibility of exact matches to exit for() loop. > 7. Uses "less than or equal to" comparison instead of "less than" > to cover the possibility of exact matches to exit for() loop. > 8. Excludes the break character from the returned string. > 9. Improves documentation and formatting. > > Best regards, Rafael. > > 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re... > <mailto:aga...@re...>>: > > Actually. > > My issue seems to be with special characters. Any help is > appreciated. I can’t seem to figure out why. > > This Doesn’t Wrap on the invoice > > TEST trademark ABC P-1700 CL 2612MPC > > > This does wrap (Much Shorter but Trademark sign inside of it). > I don’t want it to wrap. > > TEST ® ABC P-1700 CL 2612MPC > > I can make 1 modification that fixes it but I am unsure why it > is needed and again not sure of what else it will affect. > > Original code line 293 ‘while($i<$nb)’ > > This code fixes it ‘while($i<=$nb)’ > > where > > ‘$nb=mb_strlen($s);’ > > Ideas? > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com <http://www.resmart.com> > > resmart_logo > > *From:*Andrew Galuski [mailto:aga...@re... > <mailto:aga...@re...>] > *Sent:* Friday, February 13, 2015 9:48 AM > > > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > The missing spaces would make me have to alter too many forms > I believe but it is nice work. > > I think locally I can fix my issue with another small change. > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com <http://www.resmart.com> > > resmart_logo > > *From:*Rafael Chacón [mailto:raf...@gm...] > *Sent:* Wednesday, February 11, 2015 4:45 PM > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > Hi Andrew, > > I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, > replace AddTextWrap lines (80-169) with lines 3-66 of the > included file. > > Comments: > * I'm testing with last version of Nicola Asuni's TCPDF. > * It is possible to replace line 56 ("$textwidth += > $this->GetStringWidth($c);") with two lines. Those two lines > makes the function a little faster in some cases ($text width > near the cell width), but slower in other cases ($text width > far from the cell width). > > Best regards, Rafael. > > 2015-02-11 16:19 GMT-06:00 Andrew Galuski > <aga...@re... <mailto:aga...@re...>>: > > I am trouble shooting the same problem today where it wraps > text smaller than the width. The added $s = trim($s).' ';" > causes an issue for me. Or you can change a do while loop from > < to <= $nb and it appears to fix same issue. My worry was > testing all existing forms. If you can send me your update I > will test it in my environment for all my forms. > > Sent from my BlackBerry 10 smartphone on the Verizon Wireless > 4G LTE network. > > *From: *Rafael Chacón > > *Sent: *Wednesday, February 11, 2015 3:26 PM > > *To: *webERP Developers > > *Reply To: *webERP Developers > > *Subject: *Re: [WebERP-developers] PDF generator in webERP. > > Hi Vitaly, > > Thank you for writing. > > About > "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": > This line returns an array of strings, each of which is a > substring of $myrow2['narrative'] formed by splitting it on > boundaries formed by the characters Carriage_Return ("\r") and > Line_Feed ("\n"). It only works for msWindows (Unix-like and > Mac OS-10 use Line_Feed; Mac OS up to version 9 uses > Carriage_Return). > > The problem in PrintCustTransPortrait.php (and other reports) > is caused by two bugs in AddTextWarp(): > > 1. Line 108: "$s = trim($s).' ';" (extra blank character -> > the extra white line). > 2. Lines from 106 to 164: (the logic of the code -> splitting > in the last white_space of a segment smaller that the cell width). > > My purpose in asking if someone "has problem with this > function (last line line-feeded before the end) ?" is know who > else experiences that problem. > > I have a new AddTextWrap that fixes both bugs. It is faster > and produces PDF files with a slightly smaller size, but > --obviously-- it not produce the extra blank line in segments > smaller than cell width. Many users like this (no extra blank > line) but there are some users who ask me to re-do this extra > blank line. > > I would like other people tests this new AddTextWrap. Although > this extra blank line is a bug, I am not comfortable with the > idea of a potential change in actual reports. > > Best regards, Rafael. > > 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov > <vsh...@so... <mailto:vsh...@so...>>: > > Rafael, > > The addTextWrap() does not split the line like that. It is > done by this function > $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); > > in PrintCustTransPortrait.php > > > Vitaly > > > > On 2/10/2015 9:38 PM, Rafael Chacón wrote: > > HI Phil, > > Thank you for your answer. > > Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf > development, I think it will be better to directly use > TCPDF: (a) Y-coordinate= instead of calculating as from > page-bottom to cell-bottom and the script class.pdf.php > translates to page-top to cell-top to use tcpdf.php, we > can directly use page-top to cell-top and TCPDF; (b) TCPDF > has interesting functions (writeHTML, writeHTMLCell, etc.) > to write code html (a screen report) into a pdf. > > Topic 2: tcpdf 6.2.6 has new fonts and others.They may be > helpful to give more options to reports. > > Topic 3: With PrintCustTransPortrait.php (and other > reports) I have unexpected breaks (see enclose) and prints > lines with whitespace. The problems are inside AddTextWarp(). > > Regards, Rafael. > > 2015-02-09 22:34 GMT-06:00 Phil Daintree > <ph...@lo... <mailto:ph...@lo...>>: > > Yes originally used R & OS pdf library. > Moved to Oliver Plathey FPDF http://www.fpdf.org/ > The class.pdf.php was created to allow the transition to FPDF > ... then to TCPDF which was a development of FPDF which > allowed utf-8 pdfs - using CID fonts rather than embedding > a large monster font file into each pdf - so a small 10k > report becomes 2 Meg. This was not considered acceptable. > I update tcpdf from time to time. > > Not sure about 3. > > Phil > > > > Phil Daintree > > Logic Works Ltd - +64 (0)275 567890 > > http://www.logicworks.co.nz > > On 10/02/15 13:37, Rafael Chacón wrote: > > Hi, > > Some questions: > > 1. webERP begun using PHP Pdf creation - R&OS > (http://sourceforge.net/projects/pdf-php/). Then, > webERP moved to TCPDF (http://www.tcpdf.org/). Javier > de Lorenzo-Cáceres wrote ~/includes/class.pdf.php to > use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old > code). Is it right? > > 2. Someone has updated the ~/includes/tcpdf folder > with TCPDF version 6.2.6 ? > > 3. Someone has replaced the function AddTextWarp() or > has problem with this function (last line line-feeded > before the end) ? > > Best regards, Rafael. > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming. The Go Parallel Website, > > sponsored by Intel and developed in partnership with Slashdot Media, is your > > hub for all things parallel software development, from weekly thought > > leadership blogs to news, videos, case studies, tutorials and more. Take a > > look and join the conversation now.http://goparallel.sourceforge.net/ > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... <mailto:Web...@li...> > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go > Parallel Website, > sponsored by Intel and developed in partnership with > Slashdot Media, is your > hub for all things parallel software development, from > weekly thought > leadership blogs to news, videos, case studies, tutorials > and more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming. The Go Parallel Website, > > sponsored by Intel and developed in partnership with Slashdot Media, is your > > hub for all things parallel software development, from weekly thought > > leadership blogs to news, videos, case studies, tutorials and more. Take a > > look and join the conversation now.http://goparallel.sourceforge.net/ > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... <mailto:Web...@li...> > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 2015.0.5646 / Virus Database: 4284/9096 - Release > Date: 02/11/15 > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel > Website, > sponsored by Intel and developed in partnership with Slashdot > Media, is your > hub for all things parallel software development, from weekly > thought > leadership blogs to news, videos, case studies, tutorials and > more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel > Website, > sponsored by Intel and developed in partnership with Slashdot > Media, is your > hub for all things parallel software development, from weekly > thought > leadership blogs to news, videos, case studies, tutorials and > more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/ > <http://goparallel.sourceforge.net/> > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel > Website, > sponsored by Intel and developed in partnership with Slashdot > Media, is your > hub for all things parallel software development, from weekly > thought > leadership blogs to news, videos, case studies, tutorials and > more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > > > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 2015.0.5646 / Virus Database: 4284/9102 - Release Date: 02/12/15 > |
From: Rafael C. <raf...@gm...> - 2015-02-14 15:10:08
Attachments:
AddTextWrap (2015-02-13).php.zip
|
Hi Vitaly, I am happy that this code helps you. About putting the $fill parameter back: I think it is possible, but we need help. I explain myself: * In ~/includes/class.pdf.php, in function AddTextWrap(), there are two additional parameters: $border and $fill. $border is "translated" to 'LTRB' and sets two variables: $b and $b2; but $border and $b2 are not used to produce any output. Also $fill do not produce any output (only is mentioned in the argument list). * In R&OS there are two other parameters: $angle and $test. Those parameters have no relation with $border and $fill. We just copy for compatibility. * R&OS deletes addTextWrap() in version 0.12.2 and recommends to "use addText instead". The version we have has a little documentation ($test = "need to store the initial text state, as this will change during the width calculation but will need to be re-set before printing, so that the chars work out right"). We are assuming that $border and $fill were included in ~/includes/class.pdf.php with the same purpose they have in ~/includes/tcpdf/tcpdf.php. For compatibility purposes, We leave $angle and $test as they are in original R&OS's AddTextWrap() function. We add $border and $fill as they are in original Nicola Asuni's TCPDF library. I enclose this update. Here, the direct use of Nicola Asuni's TCPDF library is preferred. I agree with that those functions have more features and the scripts will be faster, but I am not sure about implications of this for users (e.g. fixing the extra blank line bug). Best regards, Rafael. 2015-02-13 21:05 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: > Hi Rafael, > > I applied your updated function to my code and started testing. So far I > like it very much. I does everything that I expected that function to do in > the first place. I found some problems in some of my forms, but not too > many. All of them due to my hacking, trying to get that function to do what > it was not doing before. > The only change I would make is to put the $fill parameter back. It is a > very useful feature for me. > > Thank you very much > > Vitaly > > On 2/13/2015 2:14 PM, Rafael Chacón wrote: > > Hi Andrew, > > Sorry, just I read you messages. > > Yes, as I said in previous messages, this new AddTextWrap fixes the extra > blank line bug. But if any user like this extra blank line bug, there is > lot of work adding a extra line to reports. > > About the problem with your text: > > I think the text does not wrap because it is using a non-breaking space > character instead of a white space character. > > A possible fix: > > $nbsp = html_entity_decode(' ', ENT_QUOTES, 'UTF-8');// Converts > non-breaking space HTML entity to their applicable character. > $text = str_replace($nbsp,' ',$text); > > Best regards, Rafael. > > 2015-02-13 13:53 GMT-06:00 Rafael Chacón <raf...@gm...>: > >> Hi, >> >> I enclose a uptdate to new addTextWrap. >> >> Changes: >> 1. Sets encoding 'UTF-8' in all multi-byte functions. >> 2. Adds the replace of '\n' text with a line feed character. This is to >> fix the possible introduction of a '\n' text instead of a line feed >> character. >> 3. Adds the delete of '\r' text. This is to fix the possible introduction >> of a '\r' text instead of a carriage return character. >> 4. Replaces hard hypen with soft hyphen as possible break position. >> 5. Privileges the use of mb_substr() instead of $text{$i} (deprecated? >> not multi-byte safe?) and $text[$i] (not multi-byte safe?). >> 6. Uses "greater than or equal to" comparison instead of "greater than" >> to cover the possibility of exact matches to exit for() loop. >> 7. Uses "less than or equal to" comparison instead of "less than" to >> cover the possibility of exact matches to exit for() loop. >> 8. Excludes the break character from the returned string. >> 9. Improves documentation and formatting. >> >> Best regards, Rafael. >> >> 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re...>: >> >> Actually. >>> >>> My issue seems to be with special characters. Any help is appreciated. >>> I can’t seem to figure out why. >>> >>> This Doesn’t Wrap on the invoice >>> >>> TEST trademark ABC P-1700 CL 2612MPC >>> >>> >>> This does wrap (Much Shorter but Trademark sign inside of it). I don’t >>> want it to wrap. >>> >>> TEST ® ABC P-1700 CL 2612MPC >>> >>> >>> >>> I can make 1 modification that fixes it but I am unsure why it is needed >>> and again not sure of what else it will affect. >>> >>> Original code line 293 ‘while($i<$nb)’ >>> >>> This code fixes it ‘while($i<=$nb)’ >>> >>> >>> >>> where >>> >>> ‘$nb=mb_strlen($s);’ >>> >>> >>> >>> Ideas? >>> >>> >>> >>> >>> >>> Best Regards, >>> >>> Andrew Galuski >>> >>> ResMart LLC. >>> >>> 817.615.2038 (Office) >>> >>> 817.821.0544 (Cell) >>> >>> www.resmart.com >>> >>> [image: resmart_logo] >>> >>> >>> >>> *From:* Andrew Galuski [mailto:aga...@re...] >>> *Sent:* Friday, February 13, 2015 9:48 AM >>> >>> *To:* webERP Developers >>> *Subject:* Re: [WebERP-developers] PDF generator in webERP. >>> >>> >>> >>> The missing spaces would make me have to alter too many forms I believe >>> but it is nice work. >>> >>> I think locally I can fix my issue with another small change. >>> >>> >>> >>> Best Regards, >>> >>> Andrew Galuski >>> >>> ResMart LLC. >>> >>> 817.615.2038 (Office) >>> >>> 817.821.0544 (Cell) >>> >>> www.resmart.com >>> >>> [image: resmart_logo] >>> >>> >>> >>> *From:* Rafael Chacón [mailto:raf...@gm... >>> <raf...@gm...>] >>> *Sent:* Wednesday, February 11, 2015 4:45 PM >>> *To:* webERP Developers >>> *Subject:* Re: [WebERP-developers] PDF generator in webERP. >>> >>> >>> >>> Hi Andrew, >>> >>> I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace >>> AddTextWrap lines (80-169) with lines 3-66 of the included file. >>> >>> Comments: >>> * I'm testing with last version of Nicola Asuni's TCPDF. >>> * It is possible to replace line 56 ("$textwidth += >>> $this->GetStringWidth($c);") with two lines. Those two lines makes the >>> function a little faster in some cases ($text width near the cell width), >>> but slower in other cases ($text width far from the cell width). >>> >>> Best regards, Rafael. >>> >>> >>> >>> 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...>: >>> >>> I am trouble shooting the same problem today where it wraps text smaller >>> than the width. The added $s = trim($s).' ';" causes an issue for me. >>> Or you can change a do while loop from < to <= $nb and it appears to fix >>> same issue. My worry was testing all existing forms. If you can send me >>> your update I will test it in my environment for all my forms. >>> >>> >>> >>> Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE >>> network. >>> >>> *From: *Rafael Chacón >>> >>> *Sent: *Wednesday, February 11, 2015 3:26 PM >>> >>> *To: *webERP Developers >>> >>> *Reply To: *webERP Developers >>> >>> *Subject: *Re: [WebERP-developers] PDF generator in webERP. >>> >>> >>> >>> Hi Vitaly, >>> >>> Thank you for writing. >>> >>> About >>> "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": >>> This line returns an array of strings, each of which is a substring of >>> $myrow2['narrative'] formed by splitting it on boundaries formed by the >>> characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for >>> msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 >>> uses Carriage_Return). >>> >>> The problem in PrintCustTransPortrait.php (and other reports) is caused >>> by two bugs in AddTextWarp(): >>> >>> 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra >>> white line). >>> 2. Lines from 106 to 164: (the logic of the code -> splitting in the >>> last white_space of a segment smaller that the cell width). >>> >>> My purpose in asking if someone "has problem with this function (last >>> line line-feeded before the end) ?" is know who else experiences that >>> problem. >>> >>> I have a new AddTextWrap that fixes both bugs. It is faster and produces >>> PDF files with a slightly smaller size, but --obviously-- it not produce >>> the extra blank line in segments smaller than cell width. Many users like >>> this (no extra blank line) but there are some users who ask me to re-do >>> this extra blank line. >>> >>> I would like other people tests this new AddTextWrap. Although this >>> extra blank line is a bug, I am not comfortable with the idea of a >>> potential change in actual reports. >>> >>> Best regards, Rafael. >>> >>> >>> >>> 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: >>> >>> Rafael, >>> >>> The addTextWrap() does not split the line like that. It is done by this >>> function >>> $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); >>> >>> in PrintCustTransPortrait.php >>> >>> >>> Vitaly >>> >>> >>> >>> On 2/10/2015 9:38 PM, Rafael Chacón wrote: >>> >>> HI Phil, >>> >>> Thank you for your answer. >>> >>> Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think >>> it will be better to directly use TCPDF: (a) Y-coordinate= instead of >>> calculating as from page-bottom to cell-bottom and the script class.pdf.php >>> translates to page-top to cell-top to use tcpdf.php, we can directly use >>> page-top to cell-top and TCPDF; (b) TCPDF has interesting functions >>> (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into >>> a pdf. >>> >>> Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to >>> give more options to reports. >>> >>> Topic 3: With PrintCustTransPortrait.php (and other reports) I have >>> unexpected breaks (see enclose) and prints lines with whitespace. The >>> problems are inside AddTextWarp(). >>> >>> Regards, Rafael. >>> >>> >>> >>> 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...>: >>> >>> Yes originally used R & OS pdf library. >>> Moved to Oliver Plathey FPDF http://www.fpdf.org/ >>> The class.pdf.php was created to allow the transition to FPDF >>> ... then to TCPDF which was a development of FPDF which allowed utf-8 >>> pdfs - using CID fonts rather than embedding a large monster font file into >>> each pdf - so a small 10k report becomes 2 Meg. This was not considered >>> acceptable. >>> I update tcpdf from time to time. >>> >>> Not sure about 3. >>> >>> Phil >>> >>> >>> >>> Phil Daintree >>> >>> Logic Works Ltd - +64 (0)275 567890 >>> >>> http://www.logicworks.co.nz >>> >>> On 10/02/15 13:37, Rafael Chacón wrote: >>> >>> Hi, >>> >>> Some questions: >>> >>> 1. webERP begun using PHP Pdf creation - R&OS ( >>> http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF ( >>> http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote >>> ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" >>> (old code). Is it right? >>> >>> 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version >>> 6.2.6 ? >>> >>> 3. Someone has replaced the function AddTextWarp() or has problem with >>> this function (last line line-feeded before the end) ? >>> >>> Best regards, Rafael. >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> >>> hub for all things parallel software development, from weekly thought >>> >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> >>> >>> >>> _______________________________________________ >>> >>> Web-erp-developers mailing list >>> >>> Web...@li... >>> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is >>> your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take >>> a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> >>> sponsored by Intel and developed in partnership with Slashdot Media, is your >>> >>> hub for all things parallel software development, from weekly thought >>> >>> leadership blogs to news, videos, case studies, tutorials and more. Take a >>> >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> >>> >>> >>> _______________________________________________ >>> >>> Web-erp-developers mailing list >>> >>> Web...@li... >>> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> No virus found in this message. >>> Checked by AVG - www.avg.com >>> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is >>> your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take >>> a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is >>> your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take >>> a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming. The Go Parallel Website, >>> sponsored by Intel and developed in partnership with Slashdot Media, is >>> your >>> hub for all things parallel software development, from weekly thought >>> leadership blogs to news, videos, case studies, tutorials and more. Take >>> a >>> look and join the conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >> > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > Web-erp-developers mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2015.0.5646 / Virus Database: 4284/9102 - Release Date: 02/12/15 > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |
From: Andrew G. <aga...@re...> - 2015-02-17 18:54:42
|
My problem is actually that the variable $nb is set to mb_strlen($s);. Since the ® character is counted as 1 by mb_strlen nb ends up being 1 less than the actual string length. So when I iterate while $i<$nb I always end up with a break if I have a multibyte character in the string (even though it is short enough to fit). If I change to $nb=iconv_strlen($s); then $nb is equal to the actual string length and I fit on 1 line (but I no longer get the extra line after. I do get the extra line after if no multi-byte characters are in the string. I think I have been on this too long. Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Rafael Chacón [mailto:raf...@gm...] Sent: Friday, February 13, 2015 2:14 PM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Andrew, Sorry, just I read you messages. Yes, as I said in previous messages, this new AddTextWrap fixes the extra blank line bug. But if any user like this extra blank line bug, there is lot of work adding a extra line to reports. About the problem with your text: I think the text does not wrap because it is using a non-breaking space character instead of a white space character. A possible fix: $nbsp = html_entity_decode(' ', ENT_QUOTES, 'UTF-8');// Converts non-breaking space HTML entity to their applicable character. $text = str_replace($nbsp,' ',$text); Best regards, Rafael. 2015-02-13 13:53 GMT-06:00 Rafael Chacón <raf...@gm...<mailto:raf...@gm...>>: Hi, I enclose a uptdate to new addTextWrap. Changes: 1. Sets encoding 'UTF-8' in all multi-byte functions. 2. Adds the replace of '\n' text with a line feed character. This is to fix the possible introduction of a '\n' text instead of a line feed character. 3. Adds the delete of '\r' text. This is to fix the possible introduction of a '\r' text instead of a carriage return character. 4. Replaces hard hypen with soft hyphen as possible break position. 5. Privileges the use of mb_substr() instead of $text{$i} (deprecated? not multi-byte safe?) and $text[$i] (not multi-byte safe?). 6. Uses "greater than or equal to" comparison instead of "greater than" to cover the possibility of exact matches to exit for() loop. 7. Uses "less than or equal to" comparison instead of "less than" to cover the possibility of exact matches to exit for() loop. 8. Excludes the break character from the returned string. 9. Improves documentation and formatting. Best regards, Rafael. 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re...<mailto:aga...@re...>>: Actually. My issue seems to be with special characters. Any help is appreciated. I can’t seem to figure out why. This Doesn’t Wrap on the invoice TEST trademark ABC P-1700 CL 2612MPC This does wrap (Much Shorter but Trademark sign inside of it). I don’t want it to wrap. TEST ® ABC P-1700 CL 2612MPC I can make 1 modification that fixes it but I am unsure why it is needed and again not sure of what else it will affect. Original code line 293 ‘while($i<$nb)’ This code fixes it ‘while($i<=$nb)’ where ‘$nb=mb_strlen($s);’ Ideas? Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Andrew Galuski [mailto:aga...@re...<mailto:aga...@re...>] Sent: Friday, February 13, 2015 9:48 AM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. The missing spaces would make me have to alter too many forms I believe but it is nice work. I think locally I can fix my issue with another small change. Best Regards, Andrew Galuski ResMart LLC. 817.615.2038 (Office) 817.821.0544 (Cell) www.resmart.com<http://www.resmart.com> [resmart_logo] From: Rafael Chacón [mailto:raf...@gm...] Sent: Wednesday, February 11, 2015 4:45 PM To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Andrew, I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace AddTextWrap lines (80-169) with lines 3-66 of the included file. Comments: * I'm testing with last version of Nicola Asuni's TCPDF. * It is possible to replace line 56 ("$textwidth += $this->GetStringWidth($c);") with two lines. Those two lines makes the function a little faster in some cases ($text width near the cell width), but slower in other cases ($text width far from the cell width). Best regards, Rafael. 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...<mailto:aga...@re...>>: I am trouble shooting the same problem today where it wraps text smaller than the width. The added $s = trim($s).' ';" causes an issue for me. Or you can change a do while loop from < to <= $nb and it appears to fix same issue. My worry was testing all existing forms. If you can send me your update I will test it in my environment for all my forms. Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network. From: Rafael Chacón Sent: Wednesday, February 11, 2015 3:26 PM To: webERP Developers Reply To: webERP Developers Subject: Re: [WebERP-developers] PDF generator in webERP. Hi Vitaly, Thank you for writing. About "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": This line returns an array of strings, each of which is a substring of $myrow2['narrative'] formed by splitting it on boundaries formed by the characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 uses Carriage_Return). The problem in PrintCustTransPortrait.php (and other reports) is caused by two bugs in AddTextWarp(): 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra white line). 2. Lines from 106 to 164: (the logic of the code -> splitting in the last white_space of a segment smaller that the cell width). My purpose in asking if someone "has problem with this function (last line line-feeded before the end) ?" is know who else experiences that problem. I have a new AddTextWrap that fixes both bugs. It is faster and produces PDF files with a slightly smaller size, but --obviously-- it not produce the extra blank line in segments smaller than cell width. Many users like this (no extra blank line) but there are some users who ask me to re-do this extra blank line. I would like other people tests this new AddTextWrap. Although this extra blank line is a bug, I am not comfortable with the idea of a potential change in actual reports. Best regards, Rafael. 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...<mailto:vsh...@so...>>: Rafael, The addTextWrap() does not split the line like that. It is done by this function $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); in PrintCustTransPortrait.php Vitaly On 2/10/2015 9:38 PM, Rafael Chacón wrote: HI Phil, Thank you for your answer. Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think it will be better to directly use TCPDF: (a) Y-coordinate= instead of calculating as from page-bottom to cell-bottom and the script class.pdf.php translates to page-top to cell-top to use tcpdf.php, we can directly use page-top to cell-top and TCPDF; (b) TCPDF has interesting functions (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into a pdf. Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give more options to reports. Topic 3: With PrintCustTransPortrait.php (and other reports) I have unexpected breaks (see enclose) and prints lines with whitespace. The problems are inside AddTextWarp(). Regards, Rafael. 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...<mailto:ph...@lo...>>: Yes originally used R & OS pdf library. Moved to Oliver Plathey FPDF http://www.fpdf.org/ The class.pdf.php was created to allow the transition to FPDF ... then to TCPDF which was a development of FPDF which allowed utf-8 pdfs - using CID fonts rather than embedding a large monster font file into each pdf - so a small 10k report becomes 2 Meg. This was not considered acceptable. I update tcpdf from time to time. Not sure about 3. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 10/02/15 13:37, Rafael Chacón wrote: Hi, Some questions: 1. webERP begun using PHP Pdf creation - R&OS (http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF (http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" (old code). Is it right? 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version 6.2.6 ? 3. Someone has replaced the function AddTextWarp() or has problem with this function (last line line-feeded before the end) ? Best regards, Rafael. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Web-erp-developers mailing list Web...@li...<mailto:Web...@li...> https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Rafael C. <raf...@gm...> - 2015-02-17 20:08:48
|
Hi Andrew: Yes, AddTextWrap() is a nightmare. Besides the bugs I mentioned, there are other things that can create problems: - $s{$i} and $s[$i] are not multi-byte safe. It is better to use: mb_substr($s, $i, 1, 'UTF-8'), with encoding included. - Instead of $nb=mb_strlen($s), it is better to use $nb=mb_strlen($s, 'UTF-8'), with encoding included. - Depending on PHP version, mb_internal_encoding('UTF-8') does not work as expected. Also other multi-byte functions (mb_substr, mb_strlen) do not work properly. See (as example): http://php.net/ChangeLog-5.php version 5.4.8 release notes. I suggest you --if you want to keep this AddTextWrap()-- to replace all functions with multi-byte safe functions and to update php version (get late fixes to mb functions). Best regards, Rafael. 2015-02-17 12:54 GMT-06:00 Andrew Galuski <aga...@re...>: > My problem is actually that the variable $nb is set to mb_strlen($s);. > Since the ® character is counted as 1 by mb_strlen nb ends up being 1 > less than the actual string length. So when I iterate while $i<$nb I always > end up with a break if I have a multibyte character in the string (even > though it is short enough to fit). > > > > If I change to $nb=iconv_strlen($s); then $nb is equal to the actual > string length and I fit on 1 line (but I no longer get the extra line > after. I do get the extra line after if no multi-byte characters are in > the string. > > > > I think I have been on this too long. > > > > > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com > > [image: resmart_logo] > > > > *From:* Rafael Chacón [mailto:raf...@gm...] > *Sent:* Friday, February 13, 2015 2:14 PM > > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > > > Hi Andrew, > > Sorry, just I read you messages. > > Yes, as I said in previous messages, this new AddTextWrap fixes the extra > blank line bug. But if any user like this extra blank line bug, there is > lot of work adding a extra line to reports. > > About the problem with your text: > > I think the text does not wrap because it is using a non-breaking space > character instead of a white space character. > > A possible fix: > > $nbsp = html_entity_decode(' ', ENT_QUOTES, 'UTF-8');// Converts > non-breaking space HTML entity to their applicable character. > $text = str_replace($nbsp,' ',$text); > > Best regards, Rafael. > > > > 2015-02-13 13:53 GMT-06:00 Rafael Chacón <raf...@gm...>: > > Hi, > > I enclose a uptdate to new addTextWrap. > > Changes: > 1. Sets encoding 'UTF-8' in all multi-byte functions. > 2. Adds the replace of '\n' text with a line feed character. This is to > fix the possible introduction of a '\n' text instead of a line feed > character. > 3. Adds the delete of '\r' text. This is to fix the possible introduction > of a '\r' text instead of a carriage return character. > 4. Replaces hard hypen with soft hyphen as possible break position. > 5. Privileges the use of mb_substr() instead of $text{$i} (deprecated? not > multi-byte safe?) and $text[$i] (not multi-byte safe?). > 6. Uses "greater than or equal to" comparison instead of "greater than" to > cover the possibility of exact matches to exit for() loop. > 7. Uses "less than or equal to" comparison instead of "less than" to cover > the possibility of exact matches to exit for() loop. > 8. Excludes the break character from the returned string. > 9. Improves documentation and formatting. > > Best regards, Rafael. > > > > 2015-02-13 9:59 GMT-06:00 Andrew Galuski <aga...@re...>: > > > > Actually. > > My issue seems to be with special characters. Any help is appreciated. I > can’t seem to figure out why. > > This Doesn’t Wrap on the invoice > > TEST trademark ABC P-1700 CL 2612MPC > > > This does wrap (Much Shorter but Trademark sign inside of it). I don’t > want it to wrap. > > TEST ® ABC P-1700 CL 2612MPC > > > > I can make 1 modification that fixes it but I am unsure why it is needed > and again not sure of what else it will affect. > > Original code line 293 ‘while($i<$nb)’ > > This code fixes it ‘while($i<=$nb)’ > > > > where > > ‘$nb=mb_strlen($s);’ > > > > Ideas? > > > > > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com > > [image: resmart_logo] > > > > *From:* Andrew Galuski [mailto:aga...@re...] > *Sent:* Friday, February 13, 2015 9:48 AM > > > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > > > The missing spaces would make me have to alter too many forms I believe > but it is nice work. > > I think locally I can fix my issue with another small change. > > > > Best Regards, > > Andrew Galuski > > ResMart LLC. > > 817.615.2038 (Office) > > 817.821.0544 (Cell) > > www.resmart.com > > [image: resmart_logo] > > > > *From:* Rafael Chacón [mailto:raf...@gm... > <raf...@gm...>] > *Sent:* Wednesday, February 11, 2015 4:45 PM > *To:* webERP Developers > *Subject:* Re: [WebERP-developers] PDF generator in webERP. > > > > Hi Andrew, > > I enclose my new AddTextWrap. Inside ~/includes/class.pdf.php, replace > AddTextWrap lines (80-169) with lines 3-66 of the included file. > > Comments: > * I'm testing with last version of Nicola Asuni's TCPDF. > * It is possible to replace line 56 ("$textwidth += > $this->GetStringWidth($c);") with two lines. Those two lines makes the > function a little faster in some cases ($text width near the cell width), > but slower in other cases ($text width far from the cell width). > > Best regards, Rafael. > > > > 2015-02-11 16:19 GMT-06:00 Andrew Galuski <aga...@re...>: > > I am trouble shooting the same problem today where it wraps text smaller > than the width. The added $s = trim($s).' ';" causes an issue for me. Or > you can change a do while loop from < to <= $nb and it appears to fix same > issue. My worry was testing all existing forms. If you can send me your > update I will test it in my environment for all my forms. > > > > Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE > network. > > *From: *Rafael Chacón > > *Sent: *Wednesday, February 11, 2015 3:26 PM > > *To: *webERP Developers > > *Reply To: *webERP Developers > > *Subject: *Re: [WebERP-developers] PDF generator in webERP. > > > > Hi Vitaly, > > Thank you for writing. > > About > "$lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative']));": > This line returns an array of strings, each of which is a substring of > $myrow2['narrative'] formed by splitting it on boundaries formed by the > characters Carriage_Return ("\r") and Line_Feed ("\n"). It only works for > msWindows (Unix-like and Mac OS-10 use Line_Feed; Mac OS up to version 9 > uses Carriage_Return). > > The problem in PrintCustTransPortrait.php (and other reports) is caused by > two bugs in AddTextWarp(): > > 1. Line 108: "$s = trim($s).' ';" (extra blank character -> the extra > white line). > 2. Lines from 106 to 164: (the logic of the code -> splitting in the last > white_space of a segment smaller that the cell width). > > My purpose in asking if someone "has problem with this function (last line > line-feeded before the end) ?" is know who else experiences that problem. > > I have a new AddTextWrap that fixes both bugs. It is faster and produces > PDF files with a slightly smaller size, but --obviously-- it not produce > the extra blank line in segments smaller than cell width. Many users like > this (no extra blank line) but there are some users who ask me to re-do > this extra blank line. > > I would like other people tests this new AddTextWrap. Although this extra > blank line is a bug, I am not comfortable with the idea of a potential > change in actual reports. > > Best regards, Rafael. > > > > 2015-02-11 8:25 GMT-06:00 Vitaly Shevkunov <vsh...@so...>: > > Rafael, > > The addTextWrap() does not split the line like that. It is done by this > function > $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); > > in PrintCustTransPortrait.php > > > Vitaly > > > > On 2/10/2015 9:38 PM, Rafael Chacón wrote: > > HI Phil, > > Thank you for your answer. > > Topic 1: From R&OS -> FPDF -> TCPDF. For future pdf development, I think > it will be better to directly use TCPDF: (a) Y-coordinate= instead of > calculating as from page-bottom to cell-bottom and the script class.pdf.php > translates to page-top to cell-top to use tcpdf.php, we can directly use > page-top to cell-top and TCPDF; (b) TCPDF has interesting functions > (writeHTML, writeHTMLCell, etc.) to write code html (a screen report) into > a pdf. > > Topic 2: tcpdf 6.2.6 has new fonts and others.They may be helpful to give > more options to reports. > > Topic 3: With PrintCustTransPortrait.php (and other reports) I have > unexpected breaks (see enclose) and prints lines with whitespace. The > problems are inside AddTextWarp(). > > Regards, Rafael. > > > > 2015-02-09 22:34 GMT-06:00 Phil Daintree <ph...@lo...>: > > Yes originally used R & OS pdf library. > Moved to Oliver Plathey FPDF http://www.fpdf.org/ > The class.pdf.php was created to allow the transition to FPDF > ... then to TCPDF which was a development of FPDF which allowed utf-8 > pdfs - using CID fonts rather than embedding a large monster font file into > each pdf - so a small 10k report becomes 2 Meg. This was not considered > acceptable. > I update tcpdf from time to time. > > Not sure about 3. > > Phil > > > > Phil Daintree > > Logic Works Ltd - +64 (0)275 567890 > > http://www.logicworks.co.nz > > On 10/02/15 13:37, Rafael Chacón wrote: > > Hi, > > Some questions: > > 1. webERP begun using PHP Pdf creation - R&OS ( > http://sourceforge.net/projects/pdf-php/). Then, webERP moved to TCPDF ( > http://www.tcpdf.org/). Javier de Lorenzo-Cáceres wrote > ~/includes/class.pdf.php to use TCPDF with "PHP_Pdf_creation_-_R&OS syntax" > (old code). Is it right? > > 2. Someone has updated the ~/includes/tcpdf folder with TCPDF version > 6.2.6 ? > > 3. Someone has replaced the function AddTextWarp() or has problem with > this function (last line line-feeded before the end) ? > > Best regards, Rafael. > > > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming. The Go Parallel Website, > > sponsored by Intel and developed in partnership with Slashdot Media, is your > > hub for all things parallel software development, from weekly thought > > leadership blogs to news, videos, case studies, tutorials and more. Take a > > look and join the conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming. The Go Parallel Website, > > sponsored by Intel and developed in partnership with Slashdot Media, is your > > hub for all things parallel software development, from weekly thought > > leadership blogs to news, videos, case studies, tutorials and more. Take a > > look and join the conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2015.0.5646 / Virus Database: 4284/9096 - Release Date: 02/11/15 > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |