-
Notifications
You must be signed in to change notification settings - Fork 153
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
The font kaiu.tff(標楷體) broken while convert pdf to png. #95
Comments
Hi @k9215105 , // call pdf2Png();
static void ghostscript_Processing(object sender, GhostscriptProcessorProcessingEventArgs e)
{
Console.WriteLine(e.CurrentPage.ToString() + " / " + e.TotalPages.ToString());
}
private static void pdf2Png()
{
string inputFile = @"c:\temp\abc.pdf";
string outputFile = @"c:\temp\abc-page-%03d.png";
int pageFrom = 1;
int pageTo = 50;
using (GhostscriptProcessor ghostscript = new GhostscriptProcessor())
{
ghostscript.Processing += new GhostscriptProcessorProcessingEventHandler(ghostscript_Processing);
List<string> switches = new List<string>();
switches.Add("-empty");
switches.Add("-dSAFER");
switches.Add("-dBATCH");
switches.Add("-dNOPAUSE");
switches.Add("-dNOPROMPT");
switches.Add("-dFirstPage=" + pageFrom.ToString());
switches.Add("-dLastPage=" + pageTo.ToString());
switches.Add("-sDEVICE=png16m");
switches.Add("-r96");
switches.Add("-dTextAlphaBits=4");
switches.Add("-dGraphicsAlphaBits=4");
switches.Add(@"-sOutputFile=" + outputFile);
switches.Add(@"-f");
switches.Add(inputFile);
ghostscript.Process(switches.ToArray());
}
} |
It works, thanks for that. |
Hi @k9215105 �, |
Sorry, it was a mistake, it works now, thanks |
<!--
/* Font Definitions */
@font-face
{font-family:PMingLiU;
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:MingLiU;
panose-1:2 2 5 9 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:PMingLiU;
panose-1:2 1 6 1 0 1 1 1 1 1;}
@font-face
{font-family:MingLiU;
panose-1:2 1 6 9 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML \9810\8A2D\683C\5F0F \5B57\5143";
margin:0cm;
font-size:12.0pt;
font-family:MingLiU;}
span.HTML
{mso-style-name:"HTML \9810\8A2D\683C\5F0F \5B57\5143";
mso-style-priority:99;
mso-style-link:"HTML \9810\8A2D\683C\5F0F";
font-family:MingLiU;}
span.pl-c
{mso-style-name:pl-c;}
span.pl-k
{mso-style-name:pl-k;}
span.pl-en
{mso-style-name:pl-en;}
span.pl-smi
{mso-style-name:pl-smi;}
span.pl-s
{mso-style-name:pl-s;}
span.pl-pds
{mso-style-name:pl-pds;}
span.pl-c1
{mso-style-name:pl-c1;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
-->您好不好意思想再請教一下,我用了這個範例是可以印出標楷體了但是不管input的pdf有幾頁,出來的圖檔都只有第一頁這是正常的嗎? 寄件者: 亂馬客傳送時間: 2021年11月29日 下午 11:39:46收件者: jhabjan/Ghostscript.NET副本: k9215105; Mention主旨: Re: [jhabjan/Ghostscript.NET] The font kaiu.tff(標楷體) broken while convert pdf to png. (Issue #95) Hi @k9215105 ,You can use GhostscriptProcessor from ProcessorSample1.// change DEVICE=tiffg4// call pdf2Tiff();static void ghostscript_Processing(object sender, GhostscriptProcessorProcessingEventArgs e){ Console.WriteLine(e.CurrentPage.ToString() + " / " + e.TotalPages.ToString());} private static void pdf2Tiff(){ string inputFile = @"c:\temp\abc.pdf"; string outputFile = @"c:\temp\abc-page-%03d.tiff"; int pageFrom = 1; int pageTo = 50; using (GhostscriptProcessor ghostscript = new GhostscriptProcessor()) { ghostscript.Processing += new GhostscriptProcessorProcessingEventHandler(ghostscript_Processing); List<string> switches = new List<string>(); switches.Add("-empty"); switches.Add("-dSAFER"); switches.Add("-dBATCH"); switches.Add("-dNOPAUSE"); switches.Add("-dNOPROMPT"); switches.Add("-dFirstPage=" + pageFrom.ToString()); switches.Add("-dLastPage=" + pageTo.ToString()); switches.Add("-sDEVICE=tiffg4"); switches.Add("-r96"); switches.Add("-dTextAlphaBits=4"); switches.Add("-dGraphicsAlphaBits=4"); switches.Add(@"-sOutputFile=" + outputFile); switches.Add(@"-f"); switches.Add(inputFile); ghostscript.Process(switches.ToArray()); }}—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using RasterizerSample1 to convert a pdf file to png.
The pdf file contains chinese word with font 標楷體(kaiu.tff), which will broken in output file.
pdf
png
The text was updated successfully, but these errors were encountered: