Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions PDFConverter.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
public class ConversorPDF {

// A aplicação foi projetada para tratar arquivos WORD, temos que cuidar para que
// alterações não mudem o comportamento, para que não exista reflexo para clientes
// legados
public String tipoDocumento = "WORD";

/**
* Esse método recebe o como entrada o arquivo que vai ser convertido
* para PDF
Expand All @@ -13,14 +8,6 @@ public class ConversorPDF {
* @return
*/
public byte[] converteParaPDF(byte[] bytesArquivo){
if(tipoDocumento.equals("WORD")) {
InputStream entrada = new ByteArrayInputStream(bytesArquivo);
com.aspose.words.Document documentoWord = new com.aspose.words.Document(entrada);
ByteArrayOutputStream documentoPDF = new ByteArrayOutputStream();
documentoWord.save(documentoPDF, SaveFormat.PDF);

return documentoPDF.toByteArray();
} else {
InputStream entrada = new ByteArrayInputStream(bytesArquivo);
Workbook workbook = new Workbook(entrada);
PdfSaveOptions opcaoSalvar = new PdfSaveOptions();
Expand All @@ -29,6 +16,5 @@ public byte[] converteParaPDF(byte[] bytesArquivo){
workbook.save(documentoPDF, opcaoSalvar);

return documentoPDF.toByteArray();
}
}
}