Skip to main content
Participant
July 21, 2025
Question

Issue with the number fomatting in german

  • July 21, 2025
  • 2 replies
  • 134 views

I have created a adobe java service to create a pdf from the excel file. The excel is having the correct number formatting for the german but when it is send for the pdf generation then the pdf is showing the number format as indian number system and not the german number system.

public byte[] convertExcelToPdf(byte[] excelFile) throws Exception {

try {

// Create PDFServices instance using the injected credentials with EU region
PDFServices pdfServices = new PDFServices(adobeCredentials);
// Create a temporary file from the uploaded file
File tempFile = createTempFile(excelFile);

try {
// Create PDF using Adobe PDF Services with European locale
return createPdfFromFile(tempFile, pdfServices, adobeConfig.getRegion());
} finally {
// Keep the temporary file for debugging - comment out the deletion
if (tempFile.exists()) {
tempFile.delete();
}
}

} catch (Exception e) {
throw new Exception("Failed to convert Excel file to PDF: " + e.getMessage(), e);
}
}

private File createTempFile(byte[] fileBytes) throws IOException {
// Create a temporary file with Excel extension
File tempFile = File.createTempFile("excel_", ".xlsx");

// Verify the file was created properly
if (!tempFile.exists() || tempFile.length() == 0) {
throw new IOException("Failed to create temporary Excel file");
}
return tempFile;
}

private byte[] createPdfFromFile(File inputFile, PDFServices pdfServices, String region) throws Exception {
try {
// Create input stream and upload asset
FileInputStream inputStream = new FileInputStream(inputFile);
Asset asset = pdfServices.upload(inputStream, PDFServicesMediaType.XLSX.getMediaType());

// Create a new job instance (for simple Excel to PDF conversion)
CreatePDFJob createPDFJob = new CreatePDFJob(asset);

// Submit the job and get the job result
String location = pdfServices.submit(createPDFJob);
PDFServicesResponse<CreatePDFResult> pdfServicesResponse = pdfServices.getJobResult(location, CreatePDFResult.class);

// Get content from the resulting asset
Asset resultAsset = pdfServicesResponse.getResult().getAsset();
StreamAsset streamAsset = pdfServices.getContent(resultAsset);

// Convert to byte array
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
streamAsset.getInputStream().transferTo(outputStream);

return outputStream.toByteArray();

} catch (ServiceApiException | ServiceUsageException | SDKException e) {
throw new Exception("Adobe API conversion failed: " + e.getMessage(), e);
} catch (IOException e) {
throw new Exception("File processing error: " + e.getMessage(), e);
}
}


This is my java code

2 replies

Joel Geraci
Community Expert
Community Expert
July 21, 2025

Don't rely on the default screen presentation, which is locale dependent. Specify the date format for the local you want. See image.

Participant
July 22, 2025

I have chnaged the locale for germany then also it is not providing me the correct number formatting. Below is the screnshot of my excel and pdf file.

Excel file:

Pdf File:

 

 

Participant
July 21, 2025

I have also set in the application.properties  

adobe.api.region=EU