Errors While Compiling ZeroClipboardPdf.as on a Mac

Errors While Compiling ZeroClipboardPdf.as on a Mac

furiousballfuriousball Posts: 4Questions: 1Answers: 0

Any help would be greatly appreciated... I am trying to change the font size for PDFs (from 11 to 8)

pdf.setFont( new CoreFont(FontFamily.HELVETICA), 8 );
if ( message != "" )
{
pdf.writeText(11, message+"\n");
}

I believe I have most everything set up correctly to recompile the swf...

I downloaded the Flex SDK 4.6 into /Users/vank/documents/Adobe/Flex-SDK/

I copied the ZeroClipboardPdf.as3 and folder lib from ...\TableTools\media\as3 to /Users/vank/documents/Adobe/Flex-SDK/bin

I downloaded and placed AlivePDF.swc in /Users/vank/documents/Adobe/Flex-SDK/frameworks/libs

I executed this command:

(fcsh) mxmlc -static-link-runtime-shared-libraries=true -library-path=/Users/vank/documents/Adobe/Flex-SDK/frameworks/libs ZeroClipboardPdf.as

But receive the following errors, looks like I don't have the files that came with AlivePDF (folders were in org/alivepdf/...):
fcsh: Assigned 4 as the compile target id
Loading configuration file /Users/vank/Documents/Adobe/Flex-SDK/frameworks/flex-config.xml
/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(204): col: 21 Error: Call to a possibly undefined method CoreFont.

        pdf.setFont( new CoreFont(FontFamily.HELVETICA), 14 );
                         ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(204): col: 53 Error: Implicit coercion of a value of type int to an unrelated type String.

        pdf.setFont( new CoreFont(FontFamily.HELVETICA), 14 );
                                                         ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(210): col: 21 Error: Call to a possibly undefined method CoreFont.

        pdf.setFont( new CoreFont(FontFamily.HELVETICA), 8 );
                         ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(210): col: 53 Error: Implicit coercion of a value of type int to an unrelated type String.

        pdf.setFont( new CoreFont(FontFamily.HELVETICA), 8 );
                                                         ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(237): col: 5 Error: Implicit coercion of a value of type Boolean to an unrelated type org.alivepdf.colors:Color.

            true,                     /* 6. alternateRowColor */
            ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(239): col: 5 Error: Implicit coercion of a value of type Number to an unrelated type org.alivepdf.colors:Color.

            .1,                       /* 8. border alpha */
            ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(241): col: 5 Error: Implicit coercion of a value of type Array to an unrelated type String.

            columns                   /* 10. columns */
            ^

/Users/vank/Documents/Adobe/Flex-SDK/bin/ZeroClipboardPdf.as(28): col: 27 Error: Definition org.alivepdf.fonts:CoreFont could not be found.

import org.alivepdf.fonts.CoreFont;
                         ^

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Sounds like it might not be including the AlivePDF library. Have you put that library into your /Users/vank/documents/Adobe/Flex-SDK/frameworks/libs path?

    Allan

  • furiousballfuriousball Posts: 4Questions: 1Answers: 0

    Thanks for the response, Allan (love DataTables, btw). I have AlivePDF.swc in /Users/vank/documents/Adobe/Flex-SDK/frameworks/libs

    Did I need to include more than just that file?

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    I don't think so. I use a relative path myself: mxmlc --target-player=10.0.0 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as . Maybe that makes a difference?

    Allan

  • furiousballfuriousball Posts: 4Questions: 1Answers: 0

    Gave it a shot...

    (fcsh) mxmlc -static-link-runtime-shared-libraries=true -library-path=lib ZeroClipboardPdf.as
    fcsh: Assigned 1 as the compile target id
    Loading configuration file /Users/vank/Documents/Adobe/Flex-SDK/frameworks/flex-config.xml
    command line: Error: unable to open 'lib'

    One thing, I have to remove the "--target-player=10.0.0", otherwise I get this...

    (fcsh) mxmlc --target-player=10.0.0 -static-link-runtime-shared-libraries=true -library-path=/Users/vank/documents/Adobe/Flex-SDK/frameworks/libs ZeroClipboardPdf.as
    fcsh: Assigned 2 as the compile target id
    Loading configuration file /Users/vank/Documents/Adobe/Flex-SDK/frameworks/flex-config.xml
    /Users/vank/Documents/Adobe/Flex-SDK/frameworks/flex-config.xml(65): Error: unable to open 'libs/player/10.0/playerglobal.swc'

      </external-library-path>
    

    Not sure if that is related or not.

  • furiousballfuriousball Posts: 4Questions: 1Answers: 0

    allan - is this something I need to escalate to paid support?

    All I really need is an swf compiled for an 8pt font for the body of the pdf

  • jeffwjeffw Posts: 38Questions: 5Answers: 0

    furiousball, were you ever able to fix this? I am looking for a similar solution, to take font size down to 10 point.

    If I rename the file to .as3, compiler gives 'unsupported file type' error.

    If i use the filename ZeroClipboardPdf.as, I have to rename the class inside the file to match the filename. Then I get the error

    ZeroClipboardPdf.as(182): col: 32 Error: Type was not found or was not a compile-time constant: PDF. [references private function configPdf():PDF]

    I'm using datatables 1.10.3 and tabletools 2.2.2.

    Anyone know of a fix?

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    This is the set of commands that I use with Flex 4.12:

        mv ZeroClipboardPdf.as ZeroClipboard.as
        mxmlc --target-player=10.0 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboard.as
        mv ZeroClipboard.swf ../swf/copy_csv_xls_pdf.swf
    

    which seems to work nicely for me.

    Allan

  • jeffwjeffw Posts: 38Questions: 5Answers: 0

    Thanks Allan. I got the Apache Flex 4.12 SDK and retried building as per your instructions, but I'm still getting

    Error: Type was not found or was not a compile-time constant: PDF.

    It's referencing this line in the .as file:

    private function configPdf():PDF

    I had to build for target player 10.2, as it looks like 10.0 isn't available any more.

    Have you seen this error or have any idea how to fix?

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    edited October 2014

    I've not seen that error I'm afraid. What OS are you building on? Not sure it will have any effect - but it might.

    My only guess is that ti isn't finding the AlivePDF library. Try removing the shared runtime flag from the compile and see if you get a different error...

    I'd offer to recompile the SWF, but I'm away from my main machine for a little hill now I'm afraid.

    Allan

  • jeffwjeffw Posts: 38Questions: 5Answers: 0

    Thanks Allan. I'm using OSX 10.7.5. Same error if I reduce compile line to

    mxmlc ZeroClipboard.as

    I'll post a fix if I find one; I wonder if other people are seeing this. Many thanks again for a great tool.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Hi,

    Back from holiday now and just recompiled the PDF. You can grab a 10pt font size varient from http://datatables.net/dev/copy_csv_xls_pdf-10.swf .

    I should perhaps offer font size as an option for TableTools' PDF export, but I know I'm going to be rewriting it the relatively near future, so reluctant to add new features to the current software...

    Allan

  • cvescovicvescovi Posts: 3Questions: 2Answers: 0
    edited January 2015

    Have to say, I have had the same problems with this, attempting to recompile using Courier font so that can generate multiline cells. Mac doesnt now support a 32bit JRE, so went to flex v4-9 and getting lots of compile errors right at the outset... Any chance the two HELVETICA references could be changed to COURIER and a recompile done? It'd be most appreciated!!

This discussion has been closed.