How to export to PDF file, use X++

gameover
gameover Member Posts: 4
edited 2005-11-08 in Dynamics AX
Hi everyone !
In axapta, I have to do a job to export a ms word file to .pdf file, withou use the pdf printer. So, anyone know the way to do it in X++ (have any COM... )?
thank to any suggestion !

Comments

  • gameover
    gameover Member Posts: 4
    Hi All,
    After search around in AOT, I found the PDFViewer is class to write a PDF file.
    I examined the PDFViewer class, but don't know how to begin (I must call
    which method, in which order to achieve a PDF file ?).
    and I try to create an instance of the PDFViewer class :
    public void new(PrintJobHeader _jobsCursor, PrintJobPages _pagesCursor)
    but I cannot know where to achieve the PrintJobHeader class/object and
    PrintJobPages class/object.

    in the main() method of PDFViewer class, I tried :
    PDFViewer pdf = new PDFViewer(null, null);
    TextBuffer tb = new TextBuffer();
    int catalogObj, infoObj;
    int xrefOffset;

    pdf.writePDFHeader(tb.getText());

    catalogObj = pdf.writePDFCatalog(tb);

    infoObj = pdf.writePDFInfoObject('From Job', 'PV', 'Test');
    xrefOffset = pdf.writePDFXref();
    pdf.writePDFTrailer();

    pdf.writePDFStartXRef(xrefOffset);
    tb = pdf.buf();

    tb.toFile('c:\\ttt1.pdf');

    the buf() method is my method added to get the buffer. But it doesn't work (the PDF file isn't "well formed" !),
    have any advise ??