原則は、PDFを使用してPDFを作成することですまた、PPTの接尾辞を検索するだけで、ページが中国のフォントになると、ページに問題があります。中国の箱は、POI処理であると疑われています。
BaiduとGoogleは長い間探していましたが、一部の人々は、それがApacheの公式ウェブサイトのバグだと言ったが、実際にはPOIができると思いますこの問題自体は、元のフォントを読んで現在のフォントに設定しますが、とにかく多くの消費があると思います。インターネット上の既製のソリューションはほとんどありません。また、ステップバイステップを試してみると、PPT形式については言及しませんでしたが、オンラインでは見つかりませんでした。
問題の前のPPTXは写真に変換されます。
解像度後、PPTXは画像に変換されます。
解決:
各形状を読み、インターネットで見つかったコードを統合したフォントに変換します。
for(xslfshape shape:slide [i] .getshapes()){if(shape instanceof xslftextshape){xslftextshape txshape =(xslftextshape)sheas + txshape.getShapeName()); out.println( " + txshape.getText()) ;完全なコードは次のとおりです(上記のソリューションを除き、そのほとんどはStackoverFlowのコードです):
Public void convertptopdf(String Source Path、String Filetype)は、fileinputStremstream = new fileinputStrea M(SourcePath = 2; pdfdocument = pdfwriter = pdfdocument(destingputs); slideimage = null; ppt .getSlides(); = 0; i ++; k]。 ; rtruns [l] .setfontname( "宋体"); (PGSIZe。Zoom)、bufferedimage.type_int_rgb); 、0、pgsize.height); TRUE)} if( "。pptx"){xmlslideshow(inputstream); setPagesize((float)pgsize.getWidth()、(float)pdfwriter.open.open(); i ++){for(xslfs hape shape:slide [i] .getshapes()){if(xslftextshape){xslftextshape txshape =(xslftextshape)shape; + ":" + txshape()); textrunlist = textpara.getExtruns(); )Math.Ceil(height * zoom)、bufferedimage_int_rgb); float(0、0、pgsize、pgsize.height); ; // javax.write(jpg」、 }} pdf document(表); Maven構成:
<Dependency> groupId> org.apache.poi </groupid> <artifactid> poi </artifactid> <! - <version> 3.13 </version> - > <バージョン> 3.9 </version> </depenc y > <依存関係> groupId> org.apache.poi </groupid> <artifactid> poi-ooxml </artifactid> <! - <バージョン> 3.10ファイナル</version> - > <バージョン> 3.9 </versi on> </dependency> <dependency> <groupid> com.ithoutpdf </groupid> <artifactid> ithextpdf </artifactid> <バージョン> 5.5.7 </version> </dependency> <dependency> <shiplency> <shiplyidf .tool </groupId> <artifactid> xmlworker </artifactid> <version> 5.5.7 </version> </dependency> <dependency> <groupid> org.apache.poi </groupid> <artif ctid> poi-scratchpad </artifactid> <! - <version> 3.12 </version> - > <バージョン> 3.9 </version> </dependency>
上記は、JavaでPPTを実装するJavaの中国語の問題の解決策です。