Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cyrillic alphabet is supported? #255

Open
clopezdiaz opened this issue Oct 26, 2016 · 9 comments
Open

cyrillic alphabet is supported? #255

clopezdiaz opened this issue Oct 26, 2016 · 9 comments

Comments

@clopezdiaz
Copy link

I send to sejda-console, setheaderfooter option, a label with latin and cyrillic characters and I obtain "?" symbols instead cyrillic characters. Latin characters are ok.

Example:

\Sejda\bin\sejda-console.bat setheaderfooter -f \Sejda\tmp\000090229601\merge.pdf -j overwrite -o \Sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l " Data ОПЕРАЦИИ IB1 "

In the sejda scrip I read:

C:\Users\usr1>\Sejda\bin\sejda-console.bat setheaderfooter -f \Sejda\tmp\000090229601\merge.pdf -j overwrite -o \Sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l " Data ???????? IB1 "
Configuring Sejda 2.6.3
Loading Sejda configuration form default sejda.xml
Starting execution with arguments: 'setheaderfooter -f \Sejda\tmp\000090229601\merge.pdf -j overwrite -o \Sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l Data ???????? IB1 '
Java version: '1.8.0_60'

Thanks.

@torakiki
Copy link
Owner

Is there any error in the log that comes after what you posted? I tested the command and it works fine. Cyrillic chars are supported but a different fallback font is used since the Helvetica-Bold doesn't support them. So in your case the task will use Helvetica-Bold to write the latin chars and NotoSans to write the cyrillic part

@clopezdiaz
Copy link
Author

This is all information, now in local mode:

C:\Users\user1a>c:\sejda\bin\sejda-console.bat setheaderfooter -f c:\sejda\tmp\000090229601\merge.pdf -j overwrite -o c:\sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l "Data ОПЕРАЦИИ IB1 "
Configuring Sejda 2.5.17
Loading Sejda configuration form default sejda.xml
Starting execution with arguments: 'setheaderfooter -f c:\sejda\tmp\000090229601\merge.pdf -j overwrite -o c:\sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l Data ???????? IB1 '
Java version: '1.8.0_60'
Validating parameters.
Starting task (org.sejda.impl.sambox.SetHeaderFooterTask@17b4cdf) execution.
Opening c:\sejda\tmp\000090229601\merge.pdf
Created output on temporary buffer C:\Users\user1a\AppData\Local\Temp\SejdaTmpBuffer526948247393380304.pdf
Applying header 'Data ???????? IB1 ' to document page 1
Applying header 'Data ???????? IB1 ' to document page 2
Applying header 'Data ???????? IB1 ' to document page 3
Applying header 'Data ???????? IB1 ' to document page 4
Applying header 'Data ???????? IB1 ' to document page 5
Applying header 'Data ???????? IB1 ' to document page 6
Applying header 'Data ???????? IB1 ' to document page 7
Applying header 'Data ???????? IB1 ' to document page 8
Applying header 'Data ???????? IB1 ' to document page 9
Applying header 'Data ???????? IB1 ' to document page 10
Applying header 'Data ???????? IB1 ' to document page 11
Applying header 'Data ???????? IB1 ' to document page 12
Task progress: 100% done
Moving C:\Users\user1a\AppData\Local\Temp\SejdaTmpBuffer526948247393380304.pdf to c:\sejda\tmp\000090229601\merge.pdf.
Task (org.sejda.impl.sambox.SetHeaderFooterTask@17b4cdf) executed in 1 second
Completed execution

@torakiki
Copy link
Owner

mm.. ok, and the resulting document header doesn't show cyrillic chars, correct?
I'm testing the same sejda version 2.5.17 but I'm on Linux and java 1.8.0_101 and everything seems fine. I'll try on my windows box using the same java version you have.
You could try upgrading sejda to the latest version and perhaps java too.

@clopezdiaz
Copy link
Author

Hello.

Thanks for your help. With the last versión more detail, but the result is the same: Data ???????? IB1 . This is the result for Helvetica-Bold. I have tried with Courier and I obtain Data ???????? IB1 too.

C:\Users\user1a>c:\sejda\bin\sejda-console.bat setheaderfooter -f c:\sejda\tmp\000090229601\merge.pdf -j overwrite -o c:\sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l " Data ОПЕРАЦИИ IB1 "
Configuring Sejda 2.7
Loading Sejda configuration form default sejda.xml
Starting execution with arguments: 'setheaderfooter -f c:\sejda\tmp\000090229601\merge.pdf -j overwrite -o c:\sejda\tmp\000090229601\ -y TOP -x LEFT -t Helvetica-Bold -d 9 -c #CC0000 -l Data ???????? IB1 '
Java version: '1.8.0_60'
Validating parameters.
Starting task (org.sejda.impl.sambox.SetHeaderFooterTask@d76f31) execution.
Opening c:\sejda\tmp\000090229601\merge.pdf
Created output on temporary buffer C:\Users\user1a\AppData\Local\Temp\SejdaTmpBuffer440053237280950496.pdf
Applying header ' Data ???????? IB1 ' to document page 1
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'Data' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write '????????' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'IB1' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'Data' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write '????????' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'IB1' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
media: [0.0,0.0,595.22,842.0] crop: [0.0,0.0,595.22,842.0]
offsets: 0.0, 0.0 and rotation
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=30,y=821]
Will write string 'Data' using font Helvetica-Bold at position java.awt.Point[x=32,y=821]
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=51,y=821]
Will write string '????????' using font Helvetica-Bold at position java.awt.Point[x=53,y=821]
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=96,y=821]
Will write string 'IB1' using font Helvetica-Bold at position java.awt.Point[x=98,y=821]
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=112,y=821]
Will write string '' using font Helvetica-Bold at position java.awt.Point[x=114,y=821]
Applying header ' Data ???????? IB1 ' to document page 2
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'Data' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write '????????' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'IB1' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'Data' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write '????????' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
Will write 'IB1' with PDType1Font Helvetica-Bold
Will write ' ' with PDType1Font Helvetica-Bold
media: [0.0,0.0,595.22,842.0] crop: [0.0,0.0,595.22,842.0]
offsets: 0.0, 0.0 and rotation
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=30,y=821]
Will write string 'Data' using font Helvetica-Bold at position java.awt.Point[x=32,y=821]
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=51,y=821]
Will write string '????????' using font Helvetica-Bold at position java.awt.Point[x=53,y=821]
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=96,y=821]
Will write string 'IB1' using font Helvetica-Bold at position java.awt.Point[x=98,y=821]
Fallback font size calculation: desired vs actual heights: 10.71000051498413 vs 10.404000163078308, original vs calculated font size: 9.0 vs 9.264706182620586
Will write string ' ' using font Helvetica at position java.awt.Point[x=112,y=821]
Will write string '' using font Helvetica-Bold at position java.awt.Point[x=114,y=821]
Task progress: 100% done
Moving C:\Users\user1a\AppData\Local\Temp\SejdaTmpBuffer440053237280950496.pdf to c:\sejda\tmp\000090229601\merge.pdf.
Task (org.sejda.impl.sambox.SetHeaderFooterTask@d76f31) executed in 1 second
Completed execution

@SantiMorenoSAP
Copy link
Contributor

The same happens to me. In the resulting document ?????? ?????? is shown instead the russian characters. It seems it doesn´t have support for UTF-8 in windows.
I use Windows 7. Java 1.8.0_111 and the last Sejda 3.0.13
An example of a command would be: sejda-console.bat setheaderfooter -f "C:\Sejda\Original.pdf" -o "C:\Sejda\Output.pdf" -j overwrite -x right -y top -t Helvetica -l "пример текста"
The console output is:
C:\Sejda\bin>sejda-console.bat setheaderfooter -f "C:\Sejda\Original.pdf" -o "C:\Sejda\Output.pdf" -j overwrite -x right -y top -t Helvetica -l "пример текста"
Configuring Sejda 3.0.13
Starting execution with arguments: 'setheaderfooter -f C:\Sejda\Original.pdf -o C:\Sejda\Output.pdf -j overwrite -x right -y top -t Helvetica -l ?????? ??????'
Java version: '1.8.0_111'
Validation skipped.
Starting task (org.sejda.impl.sambox.SetHeaderFooterTask@e0fea4) execution.
Opening C:\Sejda\Original.pdf
Created output on temporary buffer C:\Users\smdiez\AppData\Local\Temp\SejdaTmpBuffer3315689443891532010.pdf
Applying header '?????? ??????' to document page 1
Task progress: 100% done
Moving C:\Users\smdiez\AppData\Local\Temp\SejdaTmpBuffer3315689443891532010.pdf to C:\Sejda\Output.pdf.
Task (org.sejda.impl.sambox.SetHeaderFooterTask@e0fea4) executed in 0 seconds
Completed execution

@SantiMorenoSAP
Copy link
Contributor

It seems to be a java problem passing the arguments to the main function.
In this page there could be a clue using the Win32 API function GetCommandLineW:
http://stackoverflow.com/questions/7660651/passing-command-line-unicode-argument-to-java-code

@ediweissmann
Copy link
Collaborator

ediweissmann commented Apr 20, 2017

You could try to use the solution in #229 where we workaround another Windows OS limitation for the command line arguments length.

In a nutshell, create a file that contains the cli arguments, filename ending in args.txt and execute sejda-console passing this file as the single argument.

Example: bin\sejda-console.bat random12345-args.txt

The assumption is that you will be able to correctly pass the characters in UTF-8 encoding this way.

@SantiMorenoSAP
Copy link
Contributor

With the args.txt file works fine but it would be nice if we could pass the Cyrillic text in the command argument

@ediweissmann
Copy link
Collaborator

I agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants