1 Reply Latest reply on Sep 17, 2008 12:11 AM by (Alexander_Annie)

    generatePDFOutput returns PDF with encoding problems

      Hi, all!

      I'm trying to create PDF file by merging XDP with XML data via Output Service and got the following problem:
      The service works ok, and I've got my PDF generated but all "№" (U+2116) symbols gets converted to "¹" (U+00B9). All data I've passed to service is "UTF-8" encoded and have correct values for "№" symbols. Seems like there is some kind of unexpected charset conversion in output service. And I can't find the source of this problem. Where can I set output service to handle my data as pure "UTF-8" without unneeded conversions?
      Can someone help me?

      Here's the code snippet that calls the service.
      --------------------------------------------------------------
      ServiceUtils serviceUtil = new ServiceUtils();
      OutputService service = serviceUtil.getOutputService(props);

      RenderOptionsSpec renderOptions = new RenderOptionsSpec();
      renderOptions.setLinearizedPDF(true);
      renderOptions.setDebugEnabled(false);
      renderOptions.setTaggedPDF(false);

      byte[] byteStream = new byte[xmlData.available()];

      int actuallyRead = xmlData.read(byteStream);
      BLOB inDataDoc = new BLOB();
      inDataDoc.setBinaryData(byteStream);

      BLOBHolder generatePDFOutputPDFDoc = new BLOBHolder();
      BLOBHolder generatePDFOutputMetaDataDoc = new BLOBHolder();
      BLOBHolder generatePDFOutputResultDoc = new BLOBHolder();
      OutputResultHolder generatePDFOutputResult = new OutputResultHolder();


      PKIUtils.log.warn("generating output document");
      service.generatePDFOutput(TransformationFormat.PDF, xdpFileName, xdpFileLocation, null, renderOptions, inDataDoc, generatePDFOutputPDFDoc, generatePDFOutputMetaDataDoc, generatePDFOutputResultDoc,
      generatePDFOutputResult);

      PKIUtils.log.warn("retrieving result");
      byte[] result = generatePDFOutputResult.value.getGeneratedDoc().getBinaryData();

      outputDoc.write(result);
      -----------------------------------------------------

      Thank you!