0 Replies Latest reply on Jul 19, 2016 4:09 PM by vito_90

    Incorrect PDF generated from TIFF

    vito_90 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();
      }