Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Incorrect PDF generated from TIFF

Avatar

Former Community Member

Hi,

I'm using the code below to generate PDF from multipage TIFF file. For some reason, for a specific TIFF with 4 pages, generated PDF has only one page. When I substract or add fifth page to input TIFF, PDF generation is successful.The TIFF file, which causes problems, does not seem to be corrupted and can be opened normally. Am I missing some configuration or doing something wrong? The logs show that the job completed successfully.

I would be grateful for any hint how to solve this problem.

Witek

Properties connectionProps = new Properties();

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http://localhost:8080");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL, ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "username");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

File tiffFile = new File("tiffFilePath");

File pdfFile = new File("pdfFilePath");

try (FileInputStream fileInputStream = new FileInputStream(tiffFile);) {

  ServiceClientFactory serviceFactory = ServiceClientFactory.createInstance(connectionProps);

  GeneratePdfServiceClient pdfGenClient = new GeneratePdfServiceClient(serviceFactory);

  Document inDoc = new Document(fileInputStream);

  CreatePDFResult pdfResult = pdfGenClient.createPDF2(inDoc, "TIFF", null, "Standard", "No Security", null, null);

  Document createdDocument = pdfResult.getCreatedDocument();

  createdDocument.copyToFile(pdfFile);

} catch(IOException | PDFGBaseException e) {

  e.printStackTrace();

}

0 Replies