Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Incorrect PDF generated from TIFF

vito_90
Level 1
Level 1

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