Product: webviewer
Product Version: “@pdftron/webviewer”: “^8.12.1”,
Please give a brief summary of your issue:
When Office convert to PDF, Japanese/Chinese characters might be disappeared ?
Please describe your issue and provide steps to reproduce it:
Hello! I use Core.officeToPDFBuffer to convert Office to PDF buffer
flow as follow : Office —Core.officeToPDFBuffer—>buffer—>Blob —>PDF
the exported PDF loses its Japanese and Chinese characters (they become blank)
could you give me some suggestion? thanks
(using React Web and only use webviewer, code as follow)
Please provide a link to a minimal sample where the issue is reproducible:
import React,{useEffect,useRef} from “react”;
import WebViewer from “@pdftron/webviewer”;
import { Button } from “primereact/button”;
const ApmIDP =()=>{
const viewer = useRef<any>(null);
const vwr_ins = useRef<any>(null);
//export PDF
const saveBufferAsPDFDoc =(buffer:any,filename:string)=>{
const blob =new Blob([buffer],{type:'application/pdf'})
const url =URL.createObjectURL(blob);
const a = document.createElement('a');
a.href=url;
a.download=filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
useEffect(() => {
WebViewer(
{
path: '/lib/webviewer',
initialDoc: '/doc/PTTX1.pptx',
isReadOnly:true,
enableAnnotations:false,
fullAPI: true
},
(viewer.current as any),
).then((instance) => {
vwr_ins.current=instance;
});
}, []);
const ConvertAndMerge = async ()=>{
const {Core} = vwr_ins.current;
try {
debugger;
const buf= await Core.officeToPDFBuffer('/doc/PPTX1.pptx')//Convert, blank??
const blob =new Blob([buf],{type:'application/pdf'})
saveBufferAsPDFDoc(blob,'save.pdf')//export PDF
} catch (error) {
console.log(error);
}
}
return (
<>
<Button onClick={ConvertAndMerge}>Test</Button>
<div className="webviewer" ref={viewer} style={{height: "100vh"}}></div>
</>
)
}
export default ApmIDP