0
pdfファイルを作成せずに、docx/txtまたは任意の形式のバイト配列をpdf形式のバイト配列に直接変換する方法はありますか?docx形式のバイト配列をpdf形式のバイト配列に直接変換する
pdfファイルを作成せずに、docx/txtまたは任意の形式のバイト配列をpdf形式のバイト配列に直接変換する方法はありますか?docx形式のバイト配列をpdf形式のバイト配列に直接変換する
私はあなたがAspose.Words for Javaの次のコードを使用することによって、これを達成することができます、と信じて:
ByteArrayInputStream inStream = byte array of DOCX/TXT;
// Load Document from inStream
Document doc = new Document(inStream);
/* Perform any document processing tasks here */
// Save the modified document into out stream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
doc.save(baos, SaveFormat.PDF);
// You can then get the PDF document back into the InputStream as follows
InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
もfile formats that you can currently convert to PDF(バイト配列をまたはディスクに保存)をご確認くださいAspose.Words for Javaのを使用。私はAsposeとDeveloper Evangelistで働いています。
これは矛盾しています。 "docxからpdfへの変換" *は "pdfファイルの作成"です。あなたはちょうどそれをディスクに保存しませんでした... – Fildor
はい、あなたは** ByteArrayOutputStream **に書き込んで、バイト配列を取ることができます。変換ライブラリが必要です。 –