Do you have a code to generate the page, please? A minimal test case is welcome. I also do not know what to look for in the PDF, thus if there's anything wrong, then I've absolutely no idea what that is. That means I'd need also a picture of the expected result, to be able to compare it with the current result.
Also, which exact version of the litePDF do you use, please? Being it the latest 2.0.4., could you try with 2.0.3.0, please? There had been a change on the PoDoFo side, which could cause some issues with Unicode letters, which did not cause any trouble with the previous version.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello @mc-zyx
I modified hello world example and tested with litePDF version 2.0.4, 2.0.3.0 but result not as expected.
source code modified in helloworld.rar file
Thanks for the update. If it's same broken on both versions, then it's something else than I thought. Could you repack the files with something more standard, like a zip, please? I've a hard time to unpack it (when I unpack it all but the "expected" PDF claim size of several tera-bytes, which is a clear nonsense).
By the way, no need to mention my nick, I receive mail notifications without it too, the same as you received my comment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for reply
I only modify code of helloworld.cpp file in example folder of you and run test
and build with option Character Set="Use Unicode Character Set"
"""
include <windows.h></windows.h>
include <stdio.h></stdio.h>
include <string.h></string.h>
include <tchar.h></tchar.h>
include "share/litePDF.h"
int main(void)
{
int res = 0;
using namespace litePDF;
try {
TLitePDF litePDF;
//beginwrite-onlyPDFfilelitePDF.CreateFileDocument("helloworld-1.pdf");//addanewpagetoit,withlarge-enoughpixelscaleHDChDC=litePDF.AddPage(litePDF.MMToUnit(210),litePDF.MMToUnit(297),2100,2970,LitePDFDrawFlag_None);//drawthetextLOGFONTlf={0,};lf.lfHeight=-52;//~1/10ofthepageheight_tcscpy(lf.lfFaceName,_T("Times New Roman"));HFONTfnt;HGDIOBJoldFnt;fnt=CreateFontIndirect(&lf);oldFnt=SelectObject(hDC,fnt);SetTextColor(hDC,RGB(128,0,0));std::wstringszText=L"Kỹ thuật: Chụp MRI cột sống thắt lưng với các chuỗi xung T1W, T2W, STIR theo mặt phẳng sagital, T2W theo mặt phẳng axial, không tiêm thuốc đối quang từ. \r\n\ - Đường cong sinh lý cột sống thắt lưng bình thường \r\n\ - Các đĩa đệm có chiều cao và tín hiệu bình thường, không thấy thoát vị hay phồng đĩa đệm. \r\n\ - Chóp tủy ở ngang mức D12-L1, hình thái và tín hiệu bình thường. Không thấy khối choán chỗ trong tuỷ hay ống sống. \r\n\ - Các thân đốt sống có chiều cao và tín hiệu đồng đều, không thấy xẹp hay trượt đốt sống. Không thấy hình gai xương hay cầu xương. \r\n\ - Các khớp mấu sau và cung sau đốt sống không thấy bất thường. \r\n\ - Phần mềm quanh cột sống không thấy khối khu trú.";RECTrc;rc.left=50;rc.top=50;rc.right=rc.left+2100;rc.bottom=rc.top+2970;DrawText(hDC,szText.c_str(),szText.length(),&rc,DT_LEFT|DT_WORDBREAK);SelectObject(hDC,oldFnt);DeleteObject(fnt);//finishdrawinglitePDF.FinishPage(hDC);//closethedocumentlitePDF.Close();
Thanks for a quick update. It looks like the font has saved incorrect glyph widths, causing the overlap. I'll check it some time soon, but no promises when it'll be. I'm sorry.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much.
I waiting for you fix it. I using "Microsoft Print To Pdf" to generated pdf
file but it run win10 only. Some any win7, 8 can not run. it is not perfect
solution
Thanks for a quick update. It looks like the font has saved incorrect
glyph widths, causing the overlap. I'll check it some time soon, but no
promises when it'll be. I'm sorry.
Status: open Milestone: 1.0 Created: Wed May 04, 2022 10:46 AM UTC by Hoang Van Hay Last Updated: Thu May 05, 2022 07:01 AM UTC Owner: nobody Attachments:
187 Nguyen Van Cu Street, Long Bien District, Ha Noi Mobile: (+84)904180790 Email: hayhv.vimes@gmail.com hayhv.vimes@gmail.com Website: vimes.com.vn http://vimes.com.vn
Thanks for a quick update. It looks like the font has saved incorrect
glyph widths, causing the overlap. I'll check it some time soon, but no
promises when it'll be. I'm sorry.
Status: open Milestone: 1.0 Created: Wed May 04, 2022 10:46 AM UTC by Hoang Van Hay Last Updated: Thu May 05, 2022 07:01 AM UTC Owner: nobody Attachments:
187 Nguyen Van Cu Street, Long Bien District, Ha Noi Mobile: (+84)904180790 Email: hayhv.vimes@gmail.com hayhv.vimes@gmail.com Website: vimes.com.vn http://vimes.com.vn
I've been busy with some other things, thus I didn't have time to look on this yet. This is still in my todo, together with the other litePDF opened tickets. I might get to this in the following days/weeks, maybe by the end of this month, unless anything else steps in.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It helped to me to set also correct lfCharSet on the LOGFONT structure, thus the code (and GDI) knows what to use. I tried with lf.lfCharSet = CHINESEBIG5_CHARSET; and it produced a better output (I do not know whether it's the right character set for your text, I'm sorry).
Could you give it a try, please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
Sorry for replying late
I tested with lf.lfCharSet = CHINESEBIG5_CHARSET but result not expected.
This file is example when i use lf.lfCharSet = CHINESEBIG5_CHARSET
It helped to me to set also correct lfCharSet on the LOGFONT structure,
thus the code (and GDI) knows what to use. I tried with lf.lfCharSet =
CHINESEBIG5_CHARSET; and it produced a better output (I do not know
whether it's the right character set for your text, I'm sorry).
Status: open Milestone: 1.0 Created: Wed May 04, 2022 10:46 AM UTC by Hoang Van Hay Last Updated: Fri Jul 08, 2022 05:18 AM UTC Owner: nobody Attachments:
187 Nguyen Van Cu Street, Long Bien District, Ha Noi Mobile: (+84)904180790 Email: hayhv.vimes@gmail.com hayhv.vimes@gmail.com Website: vimes.com.vn http://vimes.com.vn
The changes.patch shows the changes I use. Note of the LitePDFDrawFlag_EmbedFontsSubset, I get similar output when not using it, but this makes sure the receiving part shows the same thing as you.
I shortened the text and let it draw only the few first words. The page.zip contains these files:
page.emf - to see what had been sent
page.log - decoded .emf content as the litePDF receives it
page-abcde.log - a log for a page, which draws only "ABC DE" text, aka all ASCII.
.
Looking into the page.log, the GDI decided to split the text on the Unicode characters, sometimes with accents and bottom dots and so on.
I do not know these low level font things, it seems to me the letters are a composition of a letter with some addition (accents,...). The litePDF doesn't handle these things, if the font itself doesn't contain the specified letter, then it draws what it can - in fact, it's left to the font itself.
Looking closely to the shortened output (page.pdf), I think my guess is correct. I see the "underline dots" being shifted by one letter, which can be due to the string containing a letter and the dot as two consecutive characters.
Down to the Unicode standard, your text uses "Combining Diacritical Marks". Looking on the output, there needs to be done a lot of typography to place the diacritical mark at the right place. This is kinda out of scope for the litePDF, I'm sorry. Patches are welcome, but I do not plan to make the code complex in this regard myself.
For the record, there are three ranges for the combining marks:
I believe it'll be better to be supported by the PoDoFo, thus any PoDoFo user will benefit from the change, not only the litePDF project. Please see the PoDoFo ticket for any further updates.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe it'll be better to be supported by the PoDoFo, thus any PoDoFo
user will benefit from the change, not only the litePDF project. Please see
the PoDoFo ticket for any further updates.
Status: wont-fix Milestone: 1.0 Created: Wed May 04, 2022 10:46 AM UTC by Hoang Van Hay Last Updated: Thu Jul 28, 2022 01:56 PM UTC Owner: nobody Attachments:
Hello
I want to ask you, is there any way to remove a signature that has been
signed in a pdf file through signature name or signatureIndex? And reset it
is an empty signature
Ehm, this has not much to do with this ticket, right? Just it'll be bad for people reading closed tickets to see two very different things in a single ticket.
Nonetheless, the litePDF API has no function to edit exiting signatures. The only way to do it is to use PoDoFo functions directly. If I recall correctly, the signatures in PDF have multiple conditions to be met to have them recognized, thus even if you remove the corresponding Annotation (signatures are special annotations), you'd need to ensure other conditions are void as well. I vaguely recall there is some flag set somewhere, which tells the Adobe Reader to check for signatures in the document or something like that, but it's too long time ago that I do not recall any specific detail, I'm sorry.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do you have a code to generate the page, please? A minimal test case is welcome. I also do not know what to look for in the PDF, thus if there's anything wrong, then I've absolutely no idea what that is. That means I'd need also a picture of the expected result, to be able to compare it with the current result.
Also, which exact version of the litePDF do you use, please? Being it the latest 2.0.4., could you try with 2.0.3.0, please? There had been a change on the PoDoFo side, which could cause some issues with Unicode letters, which did not cause any trouble with the previous version.
Hello @mc-zyx
I modified hello world example and tested with litePDF version 2.0.4, 2.0.3.0 but result not as expected.
source code modified in helloworld.rar file
Last edit: Hoang Van Hay 2022-05-05
Thanks for the update. If it's same broken on both versions, then it's something else than I thought. Could you repack the files with something more standard, like a zip, please? I've a hard time to unpack it (when I unpack it all but the "expected" PDF claim size of several tera-bytes, which is a clear nonsense).
By the way, no need to mention my nick, I receive mail notifications without it too, the same as you received my comment.
Thank you for reply
I only modify code of helloworld.cpp file in example folder of you and run test
and build with option Character Set="Use Unicode Character Set"
"""
include <windows.h></windows.h>
include <stdio.h></stdio.h>
include <string.h></string.h>
include <tchar.h></tchar.h>
include "share/litePDF.h"
int main(void)
{
int res = 0;
using namespace litePDF;
try {
TLitePDF litePDF;
} catch (TLitePDFException &ex) {
fprintf (stderr, "litePDF Exception: %x: %s\n", ex.getCode(), ex.getMessage());
res = 1;
}
return res;
}
"""
Thanks for a quick update. It looks like the font has saved incorrect glyph widths, causing the overlap. I'll check it some time soon, but no promises when it'll be. I'm sorry.
Thank you very much.
I waiting for you fix it. I using "Microsoft Print To Pdf" to generated pdf
file but it run win10 only. Some any win7, 8 can not run. it is not perfect
solution
On Thu, May 5, 2022 at 2:29 PM zyx mc-zyx@users.sourceforge.net wrote:
--
Thanks and Best regards
HOANG VAN HAY (MR.)
187 Nguyen Van Cu Street, Long Bien District, Ha Noi
Mobile: (+84)904180790
Email: hayhv.vimes@gmail.com hayhv.vimes@gmail.com
Website: vimes.com.vn http://vimes.com.vn
Related
Tickets:
#41Hi
Could you tell me this error can be fixed? I hope it gets fixed to upgrade
my application
On Thu, May 5, 2022 at 2:29 PM zyx mc-zyx@users.sourceforge.net wrote:
--
Thanks and Best regards
HOANG VAN HAY (MR.)
187 Nguyen Van Cu Street, Long Bien District, Ha Noi
Mobile: (+84)904180790
Email: hayhv.vimes@gmail.com hayhv.vimes@gmail.com
Website: vimes.com.vn http://vimes.com.vn
Related
Tickets:
#41I've been busy with some other things, thus I didn't have time to look on this yet. This is still in my todo, together with the other litePDF opened tickets. I might get to this in the following days/weeks, maybe by the end of this month, unless anything else steps in.
It helped to me to set also correct lfCharSet on the LOGFONT structure, thus the code (and GDI) knows what to use. I tried with
lf.lfCharSet = CHINESEBIG5_CHARSET;
and it produced a better output (I do not know whether it's the right character set for your text, I'm sorry).Could you give it a try, please?
Hi
Sorry for replying late
I tested with lf.lfCharSet = CHINESEBIG5_CHARSET but result not expected.
This file is example when i use lf.lfCharSet = CHINESEBIG5_CHARSET
On Sat, Jul 9, 2022 at 6:14 PM zyx mc-zyx@users.sourceforge.net wrote:
--
Thanks and Best regards
HOANG VAN HAY (MR.)
187 Nguyen Van Cu Street, Long Bien District, Ha Noi
Mobile: (+84)904180790
Email: hayhv.vimes@gmail.com hayhv.vimes@gmail.com
Website: vimes.com.vn http://vimes.com.vn
Related
Tickets:
#41The changes.patch shows the changes I use. Note of the
LitePDFDrawFlag_EmbedFontsSubset
, I get similar output when not using it, but this makes sure the receiving part shows the same thing as you.(I'm sorry, the browser doesn't let me add more attachments to the comment.)
It generates this PDF, which looks better than that yours, but not as the expected.
I shortened the text and let it draw only the few first words. The page.zip contains these files:
.
Looking into the page.log, the GDI decided to split the text on the Unicode characters, sometimes with accents and bottom dots and so on.
I do not know these low level font things, it seems to me the letters are a composition of a letter with some addition (accents,...). The litePDF doesn't handle these things, if the font itself doesn't contain the specified letter, then it draws what it can - in fact, it's left to the font itself.
Looking closely to the shortened output (page.pdf), I think my guess is correct. I see the "underline dots" being shifted by one letter, which can be due to the string containing a letter and the dot as two consecutive characters.
Down to the Unicode standard, your text uses "Combining Diacritical Marks". Looking on the output, there needs to be done a lot of typography to place the diacritical mark at the right place. This is kinda out of scope for the litePDF, I'm sorry. Patches are welcome, but I do not plan to make the code complex in this regard myself.
For the record, there are three ranges for the combining marks:
each of them needs special processing in the meta2pdf.cpp:drawText().
A naive pseudo-solution:
shows that it's not enough.
I forwarded this to the PoDoFo:
https://github.com/podofo/podofo/issues/3
I believe it'll be better to be supported by the PoDoFo, thus any PoDoFo user will benefit from the change, not only the litePDF project. Please see the PoDoFo ticket for any further updates.
Thank you very much
I hope this problem can be solved soon
On Wed, Aug 3, 2022, 18:04 zyx mc-zyx@users.sourceforge.net wrote:
Related
Tickets:
#41I won't have much hope, this is a complex task. Maybe if some volunteer steps in, who knows.
Hello
I want to ask you, is there any way to remove a signature that has been
signed in a pdf file through signature name or signatureIndex? And reset it
is an empty signature
Ehm, this has not much to do with this ticket, right? Just it'll be bad for people reading closed tickets to see two very different things in a single ticket.
Nonetheless, the litePDF API has no function to edit exiting signatures. The only way to do it is to use PoDoFo functions directly. If I recall correctly, the signatures in PDF have multiple conditions to be met to have them recognized, thus even if you remove the corresponding Annotation (signatures are special annotations), you'd need to ensure other conditions are void as well. I vaguely recall there is some flag set somewhere, which tells the Adobe Reader to check for signatures in the document or something like that, but it's too long time ago that I do not recall any specific detail, I'm sorry.