Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Missed Characters |
Post Reply ![]() |
Author | |
Marat.Chariev ![]() Team Player ![]() Joined: 18 Oct 13 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() Posted: 28 Jun 21 at 7:44PM |
I have a problem when converting FoxPro report into PDF file using DLL. some chars are missed:
ΑαΒβΓγδΕεΖζΗηΘθΙιΚκΛλΜΝνΞξΟοΠπΡρΣσΤτΥυΦφΧχΨψω άέίήόύώ ϊϋ ΐ and that is how it must be: ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσΤτΥυΦφΧχΨψΩω άέίήόύώ ϊϋ ΐ as you can see Δ is not presented in generated PDF file Any ideas? Please help! |
|
![]() |
|
Marat.Chariev ![]() Team Player ![]() Joined: 18 Oct 13 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
Following 3 letters are not displayed: Δ,Ω,μ The missing fonts are having the following unicodes: Δ 0394 Ω 03A9 μ 03BC Could it be the reason? I use DPLFitTextBoxA and DPLDrawTextBoxA functions to render the text. Font name defined as FontName + ' {1253} ' |
|
![]() |
|
tfrost ![]() Senior Member ![]() Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
![]() ![]() ![]() ![]() ![]() |
This may be an issue that you have to contact Foxit support about, or the font supplier. But if you can tell us which actual font file you are using, and if it is a standard easily available font, then perhaps I or one of the other users here could experiment with it to help you, at least to confirm what you have found. And it would also help if you can show your code which adds the font.
Are you subsetting the characters to include and if so is this essential? Have you experimented with not limiting the subsetted characters, or explicitly specifying all the characters above to be subsetted?
|
|
![]() |
|
Marat.Chariev ![]() Team Player ![]() Joined: 18 Oct 13 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
Thank you for your input tfrost!
I used standard fonts Courier New and Arial (Win 10) I do not use subsetting. But I tried to use it too, while trying to solve the problem, without success. Below an original code written in FoxPro I use in my program to render the text into PDF. If you have any questions about the code - please do not hesitate to ask me LPARAMETERS tcText, tnTop, tnLeft, tnHeight, tnWidth, tcFontName, tlFontBold, tlFontItalic, ; tlFontUnderline, tlFontStrikethru, tnFontSize, tnAlignment, tlTransparent, tnForeColor, ; tnFillColor, tcHyperLink, tcTitleOfFormField, tnTypeOfFormField, tcDataType,; tcReportObjectName, tcPFXFileName, tcPFXFilePassword, tcSignatureImageFileName LOCAL lcFontName LOCAL lcOldExact LOCAL lcTitleOfFormField LOCAL lcSeparator LOCAL lcCentury LOCAL lcDateFormat LOCAL lcYearFormat LOCAL lcDateFormatForScript LOCAL lnElementNumber LOCAL lnRow LOCAL lnFontID LOCAL lnFormFontID LOCAL lnForeColor LOCAL lnFillColor LOCAL lnRed LOCAL lnGreen LOCAL lnBlue LOCAL lnFillRed LOCAL lnFillGreen LOCAL lnFillBlue LOCAL lnFieldIndex LOCAL lnMultiline LOCAL lnPassword LOCAL lnFileSelect LOCAL lnDoNotSpellCheck LOCAL lnDoNotScroll LOCAL lnElementNumber LOCAL lnSignatureType LOCAL lnDecimals LOCAL lnPosSeparator LOCAL lnSeparator WITH THIS IF !EMPTY(.cUnicodeRanges) AND !EMPTY(tcDataType) AND tcDataType = 'C' tcText = .ReverseString(tcText) ENDIF *-- Add, if needed it, Field's value to Report Content Table IF !EMPTY(tcReportObjectName) *-- If tcReportObjectName is - called from Listener lnElementNumber = ASCAN(.aContentsField, tcReportObjectName) IF lnElementNumber > 0 AND; (!EMPTY(tcText) OR .lPrintEmptyField) APPEND BLANK IN (.cReportContentTable) REPLACE nPage WITH .nCurrentPage,; cReportObjectName WITH tcReportObjectName,; nTop WITH tnTop,; mSource WITH RTRIM(tcText); IN (.cReportContentTable) ENDIF ENDIF lcFontName = PROPER(tcFontName) DO CASE CASE lcFontName = 'Micre13b Match' OTHERWISE IF tlFontBold lcFontName = lcFontName + ' ' + .TranslateFontStyle('Bold') ENDIF IF tlFontItalic lcFontName = lcFontName + ' ' + .TranslateFontStyle('Italic') ENDIF ENDCASE *-- If I use CodePage the text in the Form Fields are nor displayed. *-- Looks like it except only ANSI IF EMPTY(tcTitleOfFormField) lcFontName = lcFontName + ' {' + ALLTRIM(STR(.nCodePage)) + '} ' ENDIF lcOldExact = SET('EXACT') SET EXACT ON lnElementNumber = ASCAN(.aUsedFonts, lcFontName) SET EXACT &lcOldExact IF lnElementNumber > 0 lnRow = ASUBSCRIPT(.aUsedFonts, lnElementNumber, 1) lnFontID = .aUsedFonts(lnRow, 2) ELSE IF !EMPTY(.aUsedFonts(1, 1)) DIMENSION .aUsedFonts(ALEN(.aUsedFonts, 1) + 1, 2) ENDIF DO CASE CASE 'COURIER' $ UPPER(lcFontName) AND .nCodePage = 1252 DO CASE CASE 'BOLD' $ UPPER(lcFontName) AND 'ITALIC' $ UPPER(lcFontName) lnFontID = DPLAddStandardFont(.nInstanceID, 2) CASE 'BOLD' $ UPPER(lcFontName) lnFontID = DPLAddStandardFont(.nInstanceID, 1) CASE 'ITALIC' $ UPPER(lcFontName) lnFontID = DPLAddStandardFont(.nInstanceID, 3) OTHERWISE lnFontID = DPLAddStandardFont(.nInstanceID, 0) ENDCASE OTHERWISE lnFontID = DPLAddTrueTypeFont(.nInstanceID, lcFontName, IIF(.lIncludefont, 1, 0)) ENDCASE .aUsedFonts(ALEN(.aUsedFonts, 1), 1) = lcFontName .aUsedFonts(ALEN(.aUsedFonts, 1), 2) = lnFontID ENDIF IF .lReplaceSpaceChar tcText = STRTRAN(tcText, ' ', CHR(160)) ENDIF lnResult = DPLSelectFont(.nInstanceID, lnFontID) lnForeColor = IIF(tnForeColor < 0, 0, tnForeColor) .SplitColorToRGB(lnForeColor, @lnRed, @lnGreen, @lnBlue) lnResult = DPLSetTextColor(.nInstanceID, lnRed, lnGreen, lnBlue) lnResult = DPLSetTextAlign(.nInstanceID, tnAlignment) lnResult = DPLSetTextSize(.nInstanceID, tnFontSize) DO CASE CASE tlFontStrikethru lnResult = DPLSetTextUnderline(.nInstanceID, 3) lnResult = DPLSetTextUnderlineColor(.nInstanceID, lnRed, lnGreen, lnBlue) CASE tlFontUnderline lnResult = DPLSetTextUnderline(.nInstanceID, 1) lnResult = DPLSetTextUnderlineColor(.nInstanceID, lnRed, lnGreen, lnBlue) OTHERWISE lnResult = DPLSetTextUnderline(.nInstanceID, 0) ENDCASE IF !tlTransparent lnFillColor = IIF(tnFillColor < 0 , RGB(255, 255, 255), tnFillColor) .SplitColorToRGB(lnFillColor, @lnFillRed, @lnFillGreen, @lnFillBlue) lnResult = DPLSetFillColor(.nInstanceID, lnFillRed, lnFillGreen, lnFillBlue) lnResult = DPLDrawBox(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, 1) ENDIF IF 'CODE 128' $ UPPER(lcFontName) tcText = STRTRAN(tcText, CHR(160), ' ') ENDIF DO CASE CASE !EMPTY(tcTitleOfFormField) AND INLIST(tnTypeOfFormField, 1, 6) lnElementNumber = ASCAN(.aUsedFormFonts, lnFontID) IF lnElementNumber > 0 lnRow = ASUBSCRIPT(.aUsedFormFonts, lnElementNumber, 1) lnFormFontID = .aUsedFormFonts(lnRow, 2) ELSE lnFormFontID = DPLAddFormFont(.nInstanceID, lnFontID) IF !EMPTY(.aUsedFormFonts(1, 1)) DIMENSION .aUsedFormFonts(ALEN(.aUsedFormFonts, 1) + 1, 2) ENDIF .aUsedFormFonts(ALEN(.aUsedFormFonts, 1), 1) = lnFontID .aUsedFormFonts(ALEN(.aUsedFormFonts, 1), 2) = lnFormFontID ENDIF lcTitleOfFormField = EVALUATE(tcTitleOfFormField) DO CASE CASE tnTypeOfFormField = 6 DO CASE CASE SEEK(lcTitleOfFormField, .cSignFildsList, 'FieldTitle') OTHERWISE DO CASE CASE !EMPTY(tcPFXFileName) AND !EMPTY(tcPFXFilePassword) lnSignatureType = 1 tcPFXFileName = ; IIF(!EMPTY(tcPFXFileName), EVALUATE(tcPFXFileName), '') tcSignatureImageFileName = ; IIF(!EMPTY(tcSignatureImageFileName), EVALUATE(tcSignatureImageFileName),'') OTHERWISE lnSignatureType = 0 lnFieldIndex = ; DPLNewFormField(.nInstanceID, lcTitleOfFormField, tnTypeOfFormField) lnResult = ; DPLSetFormFieldBounds(.nInstanceID, lnFieldIndex, tnLeft, tnTop, tnWidth, tnHeight) ENDCASE APPEND BLANK IN (.cSignFildsList) REPLACE ; cTitleOfFormField WITH lcTitleOfFormField,; cPFXFileName WITH tcPFXFileName,; cPFXFilePassword WITH tcPFXFilePassword,; cSignatureImageFileName WITH tcSignatureImageFileName,; cReason WITH '',; cLocation WITH '',; cContactInfo WITH '',; nPage WITH IIF(EMPTY(tcReportObjectName),.nPage,.nCurrentPage),; nTop WITH tnTop,; nLeft WITH tnLeft,; nWidth WITH tnWidth,; nHeight WITH tnHeight,; nSignatureType WITH lnSignatureType; IN (.cSignFildsList) ENDCASE OTHERWISE lnFieldIndex = DPLNewFormField(.nInstanceID, lcTitleOfFormField, tnTypeOfFormField) lnResult = DPLSetFormFieldBounds(.nInstanceID, lnFieldIndex, tnLeft, tnTop, tnWidth, tnHeight) lnResult = DPLSetFormFieldValue(.nInstanceID, lnFieldIndex, tcText) lnResult = DPLSetFormFieldAlignment(.nInstanceID, lnFieldIndex, tnAlignment) lnMultiline = 1 lnPassword = 0 lnFileSelect = 0 lnDoNotSpellCheck = 1 lnDoNotScroll = IIF(tcDataType = 'C', 0, 1) lnResult = DPLSetFormFieldTextFlags(.nInstanceID, ; lnFieldIndex, ; lnMultiline, ; lnPassword, ; lnFileSelect, ; lnDoNotSpellCheck, ; lnDoNotScroll) *-- Sets the font that the specified form field must use. lnResult = DPLSetFormFieldFont(.nInstanceID, ; lnFieldIndex, ; lnFormFontID) *-- Sets the color of the text in the form field. lnResult = DPLSetFormFieldColor(.nInstanceID, ; lnFieldIndex, ; lnRed, ; lnGreen, ; lnBlue) *-- Sets the background color of the specified form field. IF !tlTransparent lnResult = DPLSetFormFieldBackgroundColor(.nInstanceID, ; lnFieldIndex, ; lnFillRed, ; lnFillGreen, ; lnFillBlue) ENDIF *-- Sets the size of the text in the specified form field. A value of 0 indicates that the form field *-- autosizes the text to fit into the available space. lnResult = DPLSetFormFieldTextSize(.nInstanceID, ; lnFieldIndex, IIF(.lAutosizeFormFieldText, 0, tnFontSize)) DO CASE CASE tcDataType = 'N' *-- Deterine number of decimals and decimal separater lcSeparator = SET('POINT') lnPosSeparator = RAT(lcSeparator, tcText) lnDecimals = IIF(lnPosSeparator = 0, 0, LEN(tcText) - lnPosSeparator) lnSeparator = IIF(lcSeparator = '.', 1, 3) lnResult = DPLFormFieldJavaScriptAction(.nInstanceID, ; lnFieldIndex, 'K', [AFNumber_Keystroke(]+TRANSFORM(lnDecimals)+[,]+TRANSFORM(lnSeparator)+[,0,0,'',true)]) lnResult = DPLFormFieldJavaScriptAction(.nInstanceID, ; lnFieldIndex, 'F', [AFNumber_Format(]+TRANSFORM(lnDecimals)+[,]+TRANSFORM(lnSeparator)+[,0,0,'',true)]) CASE tcDataType = 'D' lcCentury = SET('CENTURY') lcDateFormat = SET('DATE') lcYearFormat = IIF(lcCentury = 'ON', 'yyyy', 'yy') DO CASE CASE INLIST(lcDateFormat, 'AMERICAN', 'MDY') lcDateFormatForScript = 'mm/dd/' + lcYearFormat CASE lcDateFormat = 'ANSI' lcDateFormatForScript = lcYearFormat + '.mm.dd' CASE INLIST(lcDateFormat, 'BRITISH/FRENCH', 'DMY') lcDateFormatForScript = 'dd/mm/' + lcYearFormat CASE lcDateFormat = 'GERMAN' lcDateFormatForScript = 'dd.mm.' + lcYearFormat CASE lcDateFormat = 'ITALIAN' lcDateFormatForScript = 'dd-mm-' + lcYearFormat CASE INLIST(lcDateFormat, 'JAPAN', 'YMD') lcDateFormatForScript = lcYearFormat + '/mm/dd' CASE lcDateFormat = 'TAIWAN' lcDateFormatForScript = lcYearFormat + '/mm/dd' CASE lcDateFormat = 'USA' lcDateFormatForScript = 'mm-dd-' + lcYearFormat OTHERWISE lcDateFormatForScript = 'dd/mm/' + lcYearFormat ENDCASE lnResult = DPLFormFieldJavaScriptAction(.nInstanceID, ; lnFieldIndex, 'K', [AFDate_KeystrokeEx('] + lcDateFormatForScript + [')]) lnResult = DPLFormFieldJavaScriptAction(.nInstanceID, ; lnFieldIndex, 'F', [AFDate_FormatEx('] + lcDateFormatForScript + [')]) ENDCASE ENDCASE *-- Form field cannot have HyperLink OTHERWISE IF .lFitTextbox lnResult = DPLFitTextBox(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, tcText, 1) ELSE lnResult = DPLDrawTextBox(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, tcText, 4) ENDIF *-- Add HyperLink IF !EMPTY(tcHyperLink) lnResult = DPLAddLinkToWeb(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, EVALUATE(tcHyperLink), 0) ENDIF ENDCASE ENDWITH |
|
![]() |
|
Marat.Chariev ![]() Team Player ![]() Joined: 18 Oct 13 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
Here is the simplified version of the code:
LPARAMETERS tcText, tnTop, tnLeft, tnHeight, tnWidth, tcFontName, tlFontBold, tlFontItalic, ; tlFontUnderline, tlFontStrikethru, tnFontSize, tnAlignment, tlTransparent, tnForeColor, ; tnFillColor, tcHyperLink, tcTitleOfFormField, tnTypeOfFormField, tcDataType,; tcReportObjectName, tcPFXFileName, tcPFXFilePassword, tcSignatureImageFileName LOCAL lcFontName LOCAL lcOldExact LOCAL lcTitleOfFormField LOCAL lcSeparator LOCAL lcCentury LOCAL lcDateFormat LOCAL lcYearFormat LOCAL lcDateFormatForScript LOCAL lnElementNumber LOCAL lnRow LOCAL lnFontID LOCAL lnFormFontID LOCAL lnForeColor LOCAL lnFillColor LOCAL lnRed LOCAL lnGreen LOCAL lnBlue LOCAL lnFillRed LOCAL lnFillGreen LOCAL lnFillBlue LOCAL lnFieldIndex LOCAL lnMultiline LOCAL lnPassword LOCAL lnFileSelect LOCAL lnDoNotSpellCheck LOCAL lnDoNotScroll LOCAL lnElementNumber LOCAL lnSignatureType LOCAL lnDecimals LOCAL lnPosSeparator LOCAL lnSeparator WITH THIS lcFontName = PROPER(tcFontName) IF tlFontBold lcFontName = lcFontName + ' ' + .TranslateFontStyle('Bold') ENDIF IF tlFontItalic lcFontName = lcFontName + ' ' + .TranslateFontStyle('Italic') ENDIF *-- If I use CodePage the text in the Form Fields are nor displayed. *-- Looks like it except only ANSI IF EMPTY(tcTitleOfFormField) lcFontName = lcFontName + ' {' + ALLTRIM(STR(.nCodePage)) + '} ' ENDIF lcOldExact = SET('EXACT') SET EXACT ON lnElementNumber = ASCAN(.aUsedFonts, lcFontName) SET EXACT &lcOldExact IF lnElementNumber > 0 lnRow = ASUBSCRIPT(.aUsedFonts, lnElementNumber, 1) lnFontID = .aUsedFonts(lnRow, 2) ELSE IF !EMPTY(.aUsedFonts(1, 1)) DIMENSION .aUsedFonts(ALEN(.aUsedFonts, 1) + 1, 2) ENDIF lnFontID = DPLAddTrueTypeFont(.nInstanceID, lcFontName, IIF(.lIncludefont, 1, 0)) .aUsedFonts(ALEN(.aUsedFonts, 1), 1) = lcFontName .aUsedFonts(ALEN(.aUsedFonts, 1), 2) = lnFontID ENDIF tcText = STRTRAN(tcText, ' ', CHR(160)) lnResult = DPLSelectFont(.nInstanceID, lnFontID) lnForeColor = IIF(tnForeColor < 0, 0, tnForeColor) .SplitColorToRGB(lnForeColor, @lnRed, @lnGreen, @lnBlue) lnResult = DPLSetTextColor(.nInstanceID, lnRed, lnGreen, lnBlue) lnResult = DPLSetTextAlign(.nInstanceID, tnAlignment) lnResult = DPLSetTextSize(.nInstanceID, tnFontSize) DO CASE CASE tlFontStrikethru lnResult = DPLSetTextUnderline(.nInstanceID, 3) lnResult = DPLSetTextUnderlineColor(.nInstanceID, lnRed, lnGreen, lnBlue) CASE tlFontUnderline lnResult = DPLSetTextUnderline(.nInstanceID, 1) lnResult = DPLSetTextUnderlineColor(.nInstanceID, lnRed, lnGreen, lnBlue) OTHERWISE lnResult = DPLSetTextUnderline(.nInstanceID, 0) ENDCASE IF !tlTransparent lnFillColor = IIF(tnFillColor < 0 , RGB(255, 255, 255), tnFillColor) .SplitColorToRGB(lnFillColor, @lnFillRed, @lnFillGreen, @lnFillBlue) lnResult = DPLSetFillColor(.nInstanceID, lnFillRed, lnFillGreen, lnFillBlue) lnResult = DPLDrawBox(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, 1) ENDIF IF .lFitTextbox lnResult = DPLFitTextBox(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, tcText, 1) ELSE lnResult = DPLDrawTextBox(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, tcText, 4) ENDIF *-- Add HyperLink IF !EMPTY(tcHyperLink) lnResult = DPLAddLinkToWeb(.nInstanceID, tnLeft, tnTop, tnWidth, tnHeight, EVALUATE(tcHyperLink), 0) ENDIF ENDWITH |
|
![]() |
|
tfrost ![]() Senior Member ![]() Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
![]() ![]() ![]() ![]() ![]() |
As expected, when I tried your full string of Greek characters in the 'Unicode Support' script in the QPL Dashboard, with Arial font, all the characters were output.
There's too much code above to know exactly which function is failing, and I am not familiar with FoxPro! But if, as the comment suggests, the problem might only be with form fields, that's a feature in QPDF I have never used, so I have no idea what the limitations are. I suggest trying to replicate the issue in as small an example as possible, preferably by modifying one of the standard script examples showing form fields or text, and if you can reproduce it there, open a support ticket.
|
|
![]() |
|
Marat.Chariev ![]() Team Player ![]() Joined: 18 Oct 13 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
I do not use form fields in this particular scenario. I attached simplifyed code above your las post (I removed unnecessary code). I use Debenu Quick PDF Library DLL v. 9.16.910.1205
|
|
![]() |
|
Marat.Chariev ![]() Team Player ![]() Joined: 18 Oct 13 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
Running code below gives me same issue - missed letters:
lcFontName = 'Arial {1253} ' lnFontID = DPLAddTrueTypeFont(.nInstanceID, lcFontName, 1) lnResult = DPLSelectFont(.nInstanceID, lnFontID) lnResult = DPLFitTextBox(.nInstanceID, 9, 30, 600, 22, tcText, 1) Result: ΑαΒβΓγδΕεΖζΗηΘθΙιΚκΛλΜΝνΞξΟοΠπΡρΣσΤτΥυΦφΧχΨψω άέίήόύώ ϊϋ ΐ Should be: ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσΤτΥυΦφΧχΨψΩω άέίήόύώ ϊϋ ΐ Missed: Δ, μ, Ω
|
|
![]() |
|
tfrost ![]() Senior Member ![]() Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
![]() ![]() ![]() ![]() ![]() |
QPF 9 is very old, and there have been many improvements and fixes in Unicode handling since 2013. Again, my suggestion is to open a support ticket with Foxit/Debenu. Omitting just a few specific characters in a string is not something that the other users here are likely to be able to resolve.
|
|
![]() |
|
tfrost ![]() Senior Member ![]() Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
![]() ![]() ![]() ![]() ![]() |
To open a support ticket, log in at www.foxit.com/login with your Foxit ID, or create one there if you do not have one already, then navigate to Support and down to Support Tickets, and select Foxit Quick PDF library from the pulldown product list.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store