Skip navigation
zolouchka77
Currently Being Moderated

Unable to create / open file

Oct 29, 2009 10:19 AM

hi

 

i try to create pdf with Output Service API Quick Starts, i copy code in the file in

Web service API so i call my output service.
i have a modele ComdeDynamiq.xdp
i have  a  xml file for merging : PurchaseOrder.xml
i add to url service ?blob=base64
but my method generatePdfOutput don't run at all : no file generate
and in my file output.xml where i put data in generatepdfOutputResultDoc.BinaryData there is :
<?xml version="1.0" encoding="UTF-8"?>
<printResult>
<status>2</status>
<requestId>611e915ba</requestId>
<context>7</context>
<messages>
<message>Unable to create / open file C:\creerPdf\Res.pdf.</message>
</messages>
<printSpec/>
</printResult>
i don't knom what doesn't run in my code?? i give it in attach files? is there somoene which could help me??
thanks
my code is below :

using

 

System;

using

 

System.IO;

using

 

System.Collections;

using

 

System.ComponentModel;

using

 

System.Data;

using

 

System.Configuration;

using

 

System.Web;

using

 

System.Web.Security;

using

 

System.ServiceModel;

using

 

WebReference;

 

///

 

<summary>

///

 

Summary description for outPut

///

 

</summary>

public

 

class TestOutPut

{

 

public TestOutPut()

{

 

//

 

// TODO: Add constructor logic here

 

//

}

 

public void Essai()

{

 

try

{

 

 

// Appel du service output

 

OutputServiceService outPutClient = new OutputServiceService();

outPutClient.Url +=

"?blob=base64";

outPutClient.Credentials =

new System.Net.NetworkCredential("administrator", "password");

 

//creation d'un blob pour stocker les données du fichier

 

BLOB inData = new BLOB();

 

//reference du fichier xml à merger avec le modèle :

 

String inPutFile = @"C:\\creerPdf\\PurchaseOrder.xml";

 

FileStream fs = new FileStream(inPutFile, FileMode.Open);

 

//on récupère la taille du flux du fichier et on crée un tableau de byte :

 

int longueur = (int)fs.Length;

 

Byte[] byteArray = new byte[longueur];

 

//on remplit le tableau de byte avec le contenu du file stream :

fs.Read(byteArray, 0, longueur);

 

//on rempli le blob

inData.binaryData = byteArray;

 

//option de run time du pdf

 

PDFOutputOptionsSpec pdfOptions = new PDFOutputOptionsSpec();

pdfOptions.fileURI =

"C:\\creerPdf\\Res.pdf";

pdfOptions.lookAhead = 300;

pdfOptions.generateManyFiles =

false;

pdfOptions.recordLevel = 1;

 

//render options :

 

RenderOptionsSpec renderOptions = new RenderOptionsSpec();

renderOptions.cacheEnabled =

true;

 

//Create empty objects to pass as arguments

 

//to the generatePDFOutput method

 

//These objects are populated by the method

 

BLOB generatePDFOutputMetaDataDoc = new BLOB();

 

BLOB generatePDFOutputResultDoc = new BLOB();

 

OutputResult outResult = new OutputResult();

 

//On crée le doc pdf

outPutClient.generatePDFOutput(

TransformationFormat.PDF, "BonCmdeDynamiq.xdp", "C:\\creerPdf\\", pdfOptions, renderOptions, inData, out generatePDFOutputMetaDataDoc, out generatePDFOutputResultDoc, out outResult);

 

//On ecrit les données vers output.pdf

 

//on rempli un tableau de byte avec les données de sortie

 

byte[] outByteArray = generatePDFOutputResultDoc.binaryData;

 

//On crée un nouveau fichier pour stocker les données

 

string FILE_NAME = "C:\\Adobe\\Output.xml";

 

FileStream fs2 = new FileStream(FILE_NAME, FileMode.OpenOrCreate);

 

//on ecrit le flux de données

 

BinaryWriter w = new BinaryWriter(fs2);

w.Write(outByteArray);

w.Close();

fs2.Close();

fs.Close();

}

 

catch(Exception ee)

{

 

Console.WriteLine(ee.Message);

}

 

}

}

 
Replies
  • Currently Being Moderated
    Oct 30, 2009 4:57 AM   in reply to zolouchka77

    Your code looks like you are trying to access one of the provided LiveCycle services (generatePDFOutput), so you don't need to create a workflow in LiveCycle Workbench.  Output provides the endpoint out of the box.

     

    It looks like your writing code in .Net, so there are a couple of things you can check.

    1 - you have a web reference OutputServiceService, does that point to the right LiveCycle server? 

    2 - on the LiveCycle side is there anything in the log?  Is the request even getting to the LC box?

     
    |
    Mark as:
  • krishHexaware
    10 posts
    Dec 16, 2011
    Currently Being Moderated
    Jan 12, 2012 9:58 PM   in reply to zolouchka77

    Hey,

     

    i am very new to adobe live cycle development.

     

    I hjave tried ur code to create dynamic PDF generation, it works fine but it is generating readonly PDF.

     

    I am not able select from dropdodn and also not able to enter in text box.

     

    could you please help and suggest me on this.

     

    Thank you

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 13, 2012 5:42 AM   in reply to krishHexaware

    This is what the Output aspect of the product does; generate documents - no interactivity.

    For interactive PDF Forms - see the Forms aspect of the product

    Different set of API / Services; using same Designer form template.

     
    |
    Mark as:
  • krishHexaware
    10 posts
    Dec 16, 2011
    Currently Being Moderated
    Jan 13, 2012 5:44 AM   in reply to Neal G. Davies

    could you please help me to get PDF on the fly from XML.

     

    which service API i should use to achive this

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2012 6:14 AM   in reply to krishHexaware

    Sorry I am not a programmer but this page should help point you in the right dirction

    http://help.adobe.com/en_US/enterpriseplatform/10.0/WorkbenchHelp/WS92 d06802c76abadb-1cc35bda128261a20dd-7fb1.html

    Look at the renderPDFForm operation

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points