I have a problem converting an rtf file in pdf A.
The problem is that the generated pdf doesn’t contain a part of the rtf file.
This line of the rtf file
"<span style=“font-size:10.0pt;mso-bidi-font-size:12.0pt;
font-family:Verdana;mso-fareast-font-family:“Times New Roman”;mso-bidi-font-family:
“Times New Roman”;mso-ansi-language:IT;mso-fareast-language:IT;mso-bidi-language:
AR-SA;mso-no-proof:yes”>per i motivi esposti in premessa di approvare la spesa
di € <span style=“font-size:10.0pt;
mso-bidi-font-size:12.0pt;font-family:Verdana;mso-fareast-font-family:“Times New Roman”;
mso-bidi-font-family:“Times New Roman”;mso-ansi-language:IT;mso-fareast-language:
IT;mso-bidi-language:AR-SA”>5.500,00<span style=“font-size:10.0pt;
mso-bidi-font-size:12.0pt;font-family:Verdana;mso-fareast-font-family:“Times New Roman”;
mso-bidi-font-family:“Times New Roman”;mso-ansi-language:IT;mso-fareast-language:
IT;mso-bidi-language:AR-SA;mso-no-proof:yes”> <span style=“font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:
Verdana;mso-fareast-font-family:“Times New Roman”;mso-bidi-font-family:“Times New Roman”;
mso-ansi-language:IT;mso-fareast-language:IT;mso-bidi-language:AR-SA”>(IVA
cpr.)<span style=“font-size:10.0pt;mso-bidi-font-size:12.0pt;
font-family:Verdana;mso-fareast-font-family:“Times New Roman”;mso-bidi-font-family:
“Times New Roman”;mso-ansi-language:IT;mso-fareast-language:IT;mso-bidi-language:
AR-SA”> <!–[if gte mso 10]>
<![endif]–>"
is converted in pdf in this way:
"per i motivi esposti in premessa di approvare la spesa di € ,00 (IVA cpr.) "
The number disappears !!
I attach the rtf file, the generated pdf file.
This is the code involved:
public static void testConvertpdf() throws Exception {
System.out.println(“begin”);
byte[] file = getFile(“test.rtf”);
PdfAgent instance = new PdfAgent();
Documento docIn = new Documento();
docIn.setContenuto(file);
Documento doc = instance.convertToPdf(docIn);
FileUtils.writeByteArrayToFile(new File(“output.pdf”), doc.getContenuto());
System.out.println(“end”);
}
PdfAgent:
public Documento convertToPdf(Documento file) throws Exception {
ByteArrayInputStream is = new ByteArrayInputStream(file.getContenuto());
com.aspose.words.Document doc = new com.aspose.words.Document(is);
PdfSaveOptions pdfOptions = new PdfSaveOptions();
pdfOptions.setCompliance(PdfCompliance.PDF_A_1_B);
ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
doc.save(dstStream, pdfOptions);
Documento pdfFile = new Documento();
pdfFile.setContenuto(dstStream.toByteArray());
return pdfFile;
}
Thanks
It happens only if the text contains the character $ or <span style=“font-size:10.0pt;mso-bidi-font-size:12.0pt;
font-family:Verdana;mso-fareast-font-family:“Times New Roman”;mso-bidi-font-family:
“Times New Roman”;mso-ansi-language:IT;mso-fareast-language:IT;mso-bidi-language:
AR-SA;mso-no-proof:yes”>€ and there is something after written in bold.
I’m using aspose word 16.8.0