Copy link to clipboard
Copied
Hi,
I want to display Greek characters in the pdf Doc using c++, but after Stamping it shows Junk Character...
I am using PDEText Object to Add text to the pdf doc.
Please anyone Help me..
Thanks...
[Here is the list of all Adobe forums... https://forums.adobe.com/welcome]
[Encore is to create a DVD... moved to Acrobat programming forum... Mod]
Here is some sample code for writing Unicode values into a PDF. It shows five different languages.
https://github.com/datalogics/adobe-pdf-library-samples/blob/master/CPlusPlus/Sample_Source/Text/UnicodeText/UnicodeText.cpp
Copy link to clipboard
Copied
That suggests that the PDEFont you are using does not match the encoding of the text. What steps have you taken to make sure the font encoding includes Greek?
Copy link to clipboard
Copied
I have not done any Encoding,,Just create PDEFont and Added text to the PDEText Object and Place it into the PDF Doc...
I dont know how to Encode Diffrent Language Characters....
I have used the following Code to create pdeFont.
pdeFont = PDEFontCreate(&pdeFontAttrs, sizeof(pdeFontAttrs), 0, 255, 0, /* Widths*/ 0, ASAtomNull,/* Encoding*/ 0, 0, 0, 0);/* Font embedding */
Copy link to clipboard
Copied
Have you picked a font that contains Greek characters and embedded it? Going from Latin1 characters ro other encodings is a very big leap in complexity. please look into the fonts — encodings chapter of the PDF specification for concepts needed.
Copy link to clipboard
Copied
Thank you so much...for your Reply...
I try to Understand Font Encoding....
Copy link to clipboard
Copied
I have tried to Encode PDEFont using the following code...
PDSysFont sysFont = PDFindSysFont(&pdeFontAttrs, sizeof(pdeFontAttrs), 0);
PDSysEncoding sysEncoding = PDSysEncodingCreateFromCMapName(ASAtomFromString("UniJIS-UTF16-H")); //encoding used is "UniJIS-UTF16-H"
pdeFont = PDEFontCreateFromSysFontAndEncoding(sysFont, sysEncoding, pdeFontAttrs.name, kPDEFontCreateEmbedded | kPDEFontCreateSubset | kPDEFontEncodeByGID | kPDEFontDeferWidths | kPDEFontCreateToUnicode);
pdeFont = PDEFontCreateFromSysFont(sysFont, kPDEFontCreateEmbedded);
pdeFont = PDEFontCreate(&pdeFontAttrs, sizeof(pdeFontAttrs), 0, 255, 0, /* Widths*/ 0, ASAtomNull,/* Encoding*/ 0, 0, 0, 0);
Copy link to clipboard
Copied
Why would you choose a Japanese encoding (UniJIS)? And even if that was the one you wanted, you don’t bother passing it to PDEFontCreate()…
Copy link to clipboard
Copied
Please Suggest me...How i need to go for Encode Greek Characters...and Displayed those in the PDF Doc...
Thanks
Copy link to clipboard
Copied
There is a sample in the SDK that shows how to draw Unicode text in a PDF. Have you looked at that sample?
Copy link to clipboard
Copied
I was new in C++....
No...I am Looking for SDK Samples..
Please Send me Some code about how to add encoded text into pdf Doc...This was more helpful to me..
Thank You..
Copy link to clipboard
Copied
The encoding will be custom, not one of the few built in names. Do NOT expect to be able to use Unicode ! So, what encoding (character set) are you using for your Greek characters. If you don't know the exact hex values in your string, now is the time to find out.
Copy link to clipboard
Copied
I want to Display the Character Set "Acuta 12358µ Regulatory Informative System" text into PDF Doc.
But when I stamp the Text into PDF Doc...it Looks like
here...When I debugging, CString Shows Exact String what I Given Input..
but When I add Text into PDEText Object it shows Different Character means "Acuta 12358ae Regulatory System....."
Copy link to clipboard
Copied
Please answer my question exactly. We cannot tell anything about the encoding from copy/paste text. Please don't tell us that it shows right on screen, that is not the answer without knowing the platform app and system locale. If you don't know the encoding what is the exact hex value of the "mu"?
Copy link to clipboard
Copied
I have used the following code for the Font Encoding
const std::string strFontName = FontName;
pdeFontAttrs.name = ASAtomFromString(strFontName.c_str()); /* font name */
pdeFontAttrs.type = ASAtomFromString("Type1"); /* font type */
pdeFont = PDEFontCreate(&pdeFontAttrs, sizeof(pdeFontAttrs), 0, 255, 0, /* Widths*/ 0, ASAtomNull,/* Encoding*/ 0, 0, 0, 0);/* Font embedding */
PDSysEncoding sysEncoding = PDSysEncodingCreateFromCMapName(ASAtomFromString("Identity-H"));
PDEFontCreateFlags fontCreateFlags = (PDEFontCreateFlags)(kPDEFontCreateToUnicode | kPDEFontCreateEmbedded | kPDEFontWillSubset);
PDSysFont sysFont = PDFindSysFont(&pdeFontAttrs, sizeof(pdeFontAttrs), 0);
pdeFont = PDEFontCreateFromSysFontAndEncoding(sysFont, sysEncoding, pdeFontAttrs.name, fontCreateFlags);
pdeFont = PDEFontCreateFromSysFont(sysFont, kPDEFontCreateEmbedded);
After Doing this...Junk character not Displayed but instead of Original Character it shows Different Formats.
I don't know Where i am Wrong.
Thanks in Advance.
Copy link to clipboard
Copied
You never answered my questions about what encoding you have the text in. You can’t do anything unless you know that, so why not work in answering it?
Copy link to clipboard
Copied
Ansi Encoding...
Copy link to clipboard
Copied
Please tel me the Steps to Display Exact same character in the PDF Doc...
Thanks...
Copy link to clipboard
Copied
No it is not ANSI because there is no mu in ANSI. You have to know this. What hex code is it?
Copy link to clipboard
Copied
The Hexa value for Mu is;&‌#x03BC
Which Encoding I need to Do...
Copy link to clipboard
Copied
Not the HTML code. Please examine YOUR DATA to see what hex code is used. This is about YOUR data, not a magic recipe that will solve this for everyone.
Copy link to clipboard
Copied
I just convrted my string to Hexadecimal Value.
For "Mu" I get an Hexadecimal value as "B5".
Copy link to clipboard
Copied
Here is some sample code for writing Unicode values into a PDF. It shows five different languages.
https://github.com/datalogics/adobe-pdf-library-samples/blob/master/CPlusPlus/Sample_Source/Text/UnicodeText/UnicodeText.cpp
Copy link to clipboard
Copied
Thank a Lot...for All replies...
it was working....