1 Reply Latest reply on Dec 8, 2011 8:57 AM by superflexer

    toImage issue with Livecycle ES2 after migration from ES

    superflexer

      Recently upgraded to LivecycleES2 and using OutputES2 component to perform the pdf to Image conversion. The application is using the new endpoints to the Livecycle ES2 deployed on Websphere application server 7.The application still has Livecycle ES API using old method toImage to perform

      pdf to Tiff converstion :

      tiffDoc = convertPDFClient.toImage(pdfDoc, spec);

       

      Unfortunately the size of the resulting document when pointing to new ES2 livecycle server is only 8 bytes. Infact the image file produced is such that all image editor say "No preview available" since its size is only 1KB. Where as the size comes just fine when running against the old ES livecycle instance.

       

      The whole code is as below :

       

      public byte[] pdf2Tiff(byte[] pdf) throws LiveCycleException {

              log.trace("Entering pdf2Tiff");

              if (log.isTraceEnabled()) log.trace("pdf size: " + pdf.length);

              Document pdfDoc = new Document(pdf);

              Document tiffDoc = null;

              byte[] bytes = null;

              try {

                  if (convertPdfClient == null) convertPdfClient = new ConvertPdfServiceClient(factory);

                  ToImageOptionsSpec spec = new ToImageOptionsSpec();

                  spec.setImageConvertFormat(ImageConvertFormat.TIFF);

                  spec.setGrayScaleCompression(GrayScaleCompression.None);

                  spec.setColorCompression(ColorCompression.None);

                  spec.setRgbPolicy(RGBPolicy.Off);

                  spec.setCmykPolicy(CMYKPolicy.Off);

                  spec.setColorSpace(ColorSpace.Monochrome);

                  spec.setResolution(imageResolution);

                  spec.setMonochrome(MonochromeCompression.None);

                  spec.setGrayScalePolicy(GrayScalePolicy.Off);

       

                  tiffDoc = convertPdfClient.toImage(pdfDoc, spec);               // gives only 8 bytes of tiffDoc in ES2 compared to complete 187580 with ES

                  bytes = readBytes(tiffDoc, pdf.length, imageSizeMultiplier);

                  setException(null);

              } catch (Exception e) {

                  setException(e);

                  throw new LiveCycleException("", "", e.getMessage(), "");

              } finally {

                  if (pdfDoc != null) pdfDoc.dispose();

                  if (tiffDoc != null) tiffDoc.dispose();

              }

              log.trace("Exiting pdf2Tiff");

              super.recordLastActivity();

              return bytes;

          }

       

       

      If anyone has any idea why this might be happening, I will appreciate the help.