Word Blank page being inserted within document

Hello,

I’ve got an issue for some Word files that when I save it as PDF, it just adds in the middle an empty file.
I can’t share with you the problematic file, but maybe you know about the issue, we got no errors on the server side (aws, linux, java, aspose-pdf: 25.2)?
That’s the code:
@CrossOrigin
@PostMapping(“/createPdf”)
public String createPdf(@RequestHeader(value = “X-API-KEY”, required = false) String apiKey,
@RequestBody FileData_v5 fileData) throws Exception {
Path requestDirectory = null;
try {
LOGGER.info(“********************** New PDF Request V5 *************************”);
LOGGER.info(fileData.toString());

		if (apiKey == null || apiKey.isBlank() || apiKey.isEmpty()) {
			LOGGER.error("No API key in request");
		} else if (!X_API_KEY.equals(apiKey)) {
			LOGGER.error("API Key is invalid");
			throw new BadCredentialsException("API Key is invalid");
		}
		requestDirectory = Utils.createRequestDirectory(fileData);
		Document pdfDocument = pdfInit(fileData);
		addDocumentPrivilege(fileData.getDocumentState(), pdfDocument, fileData.getObjId());
		pdfDocument.save(Path.of(requestDirectory.toString(), fileData.getFileId().concat(".pdf")).toString());
		
		String pdfId = uploadPdfToSF(fileData, false);
		Utils.deleteDirectory(requestDirectory);
		LOGGER.info("*************************** PDF created successfully! ***************************");
		JSONObject response = new JSONObject();
		response.put("pdfId", pdfId);
		return response.toString();
	} catch (Exception e) {
		LOGGER.error("Generate PDF error for file - {}.{} The error- {}", fileData.getFileId(),
				fileData.getExtension(), e.getMessage());
		LOGGER.error(Arrays.toString(e.getStackTrace()));
		Utils.deleteDirectory(requestDirectory);
		throw e;
	}
}

Thanks !!
Ayelet

@AyeletB

The code snippet seems quite abstract as we don’t know the details of the methods that you are using. Furthermore, are you converting Word to PDF when this issue is happening? OR is it happening when you save PDF file with further processing using Aspose.PDF?

Hello,
Thanks for response.
What i’ve notice is that there’s an image inside the word file, and when I generate the file to pdf it adds a black page above the page with the image.
When I make the image smaller it doesnt happen. (I dont know if its the convert or the save)
Did you know this kind of issue?
Thanks!

@AyeletB

We haven’t been able to notice this kind of issues before. Also, it looks like that it is happening with Aspose.Words. Can you please share sample file and sample code snippet for our reference?