Page Index Toggle Pages: 1 2 3 [4] 5  Send TopicPrint
Very Hot Topic (More than 25 Replies) how to set wpf spreadsheet export pdf font. (Read 22049 times)
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #45 - Jun 9th, 2020 at 10:13pm
Print Post  
The build files.
  

2020-06-10_061208.png ( 55 KB | 160 Downloads )
2020-06-10_061208.png
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: how to set wpf spreadsheet export pdf font.
Reply #46 - Jun 10th, 2020 at 5:41am
Print Post  
Unfortunately this log is incomplete, and not showing the PDF font markup generated. Please wait for export to finish before attaching. Export a smaller sheet if this one takes too long with all the logging. Or maybe the forum upload did not work correctly, please attach it as a zip if original log is larger than the 66K log.txt showing attached. We need to see this part of the log, if any character there is outside of ASCII character range, the font object will not be encoded correctly in PDF -

Code
Select All
using font name MingLiU
<<
/Type /Font
/Subtype /Type0
/DescendantFonts [24 0 R]
/BaseFont /MingLiU
/Encoding /Identity-H
/ToUnicode 26 0 R
>>

<<
/Type /Font
/Subtype /CIDFontType2
/BaseFont /MingLiU
/CIDSystemInfo <<
/Registry (Adobe)
/Ordering (Identity)
/Supplement 0
>>
/CIDToGIDMap/Identity
/FontDescriptor 25 0 R
/DW 1000
... 

  
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #47 - Jun 10th, 2020 at 7:38am
Print Post  
Sorry for sending the incomplete file. I need run from the exe file otherwise it will failed to complete.
  

yyy.rar ( 16 KB | 174 Downloads )
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: how to set wpf spreadsheet export pdf font.
Reply #48 - Jun 10th, 2020 at 7:56am
Print Post  
Attach the log.txt file please. That was the pdf now Smiley We need to see some plain-text PDF objects logged in the txt file, before it gets encoded as bytes in PDF.
  
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #49 - Jun 10th, 2020 at 7:59am
Print Post  
Oh, Sorry
  

log.rar ( 0 KB | 170 Downloads )
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: how to set wpf spreadsheet export pdf font.
Reply #50 - Jun 10th, 2020 at 8:06am
Print Post  
Thanks, so we are still trying to encode Chinese name indeed -

<<
/Type /Font
/Subtype /Type0
/DescendantFonts [20 0 R]
/BaseFont /細明體
/Encoding /Identity-H
/ToUnicode 22 0 R
>>

Probably getting it from System.Drawing.Font used internally by our PdfLib. Our developer will try to fix that today.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: how to set wpf spreadsheet export pdf font.
Reply #51 - Jun 10th, 2020 at 2:02pm
Print Post  
Please try exporting with this build -
https://mindfusion.eu/_temp/pdf_font_name.zip

Our internal PDF library now calls FontFamily.GetName(0), which returns a "language neutral" name that should work hopefully -
https://docs.microsoft.com/en-us/dotnet/api/system.drawing.fontfamily.getname

Regards,
Slavcho
  
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #52 - Jun 11th, 2020 at 2:02am
Print Post  
I still get the same result.  Embarrassed
  

iJO_i___2020-06-11_100224.png ( 84 KB | 154 Downloads )
iJO_i___2020-06-11_100224.png
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #53 - Jun 11th, 2020 at 2:03am
Print Post  
Here is the log file
  

log_001.rar ( 0 KB | 170 Downloads )
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #54 - Jun 11th, 2020 at 6:01am
Print Post  
           private void GenerateRandomFont(ref Cell cell)
           {
                 var style = cell.Style;

                 style.FontName = "MingLiU";
                 style.FontBold = false;
                 style.FontItalic = false;
                 //style.FontSize = 14;
           }

                             for (int k = 0; k < i; k++)
                             {
                                   var cell = activeSheet.Cells[k, x + 1];
                                   cell.Data = dataRow[k];
                                   GenerateRandomFont(ref cell);
                             }


font for  Spreadsheet
  

iJO_i___2020-06-11_135752.png ( 8 KB | 148 Downloads )
iJO_i___2020-06-11_135752.png
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #55 - Jun 11th, 2020 at 6:07am
Print Post  
If I did not use these two lines. Only Chinese characters will not show otherwise none of the display is correct.

                       pdfExporter.AutoDetectEncoding = false;
                       pdfExporter.DefaultEncoding = Encoding.Unicode;


without these code

  

iJO_i___2020-06-11_140708.png ( 39 KB | 37 Downloads )
iJO_i___2020-06-11_140708.png
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: how to set wpf spreadsheet export pdf font.
Reply #56 - Jun 11th, 2020 at 6:16am
Print Post  
Does attached console project display "MingLiU" in English on any line when you run it?
  

FontNameTest.zip ( 32 KB | 275 Downloads )
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #57 - Jun 11th, 2020 at 7:05am
Print Post  
Show nothing from the console.  From running your attach program.
  

iJO_i___2020-06-11_150432.png ( 12 KB | 154 Downloads )
iJO_i___2020-06-11_150432.png
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: how to set wpf spreadsheet export pdf font.
Reply #58 - Jun 11th, 2020 at 7:07am
Print Post  
It should open an actual console process and write in its console, not Visual Studio's one. Please run it using Ctrl+F5 and it will pause before closing (F5 alone closes immediately).
  
Back to top
 
IP Logged
 
David Chiang
Junior Member
**
Offline


I Love MindFusion!

Posts: 75
Joined: Apr 15th, 2020
Re: how to set wpf spreadsheet export pdf font.
Reply #59 - Jun 11th, 2020 at 7:18am
Print Post  
Here it is.
  

iJO_i___2020-06-11_151739.png ( 13 KB | 161 Downloads )
iJO_i___2020-06-11_151739.png
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 3 [4] 5 
Send TopicPrint