Results 1 to 9 of 9

Thread: FileToString with non ASII files

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862

    FileToString with non ASII files

    Hi all,
    FileToString, work also with PDF files?

    With VFP work... With lianja seem not..

    thanks
    Fabio

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,726
    Hi Fabio,

    As you stated in your ticket your requirement was to insert large strings (base64 encoded text) into the MS COM/ActiveX for XML.

    I have extended the activex support in Lianja 5 to enable you to to do this by recognizing special string prefixes when setting properties in activex objects:

    e.g.

    // read a text file
    oItem.someproperty = "text://filename.png"

    // read a binary file
    oItem.someproperty = "bin://filename.png"

    // read a binary file and base64 encode it
    oItem.someproperty = "base64://filename.png"
    Last edited by barrymavin; 2019-01-15 at 18:35.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    Hy Barry
    How can I use it?

    a = object()
    a.pdf = "bin:C:\Users\Fabio\Documents\Lavoro\CEGEKA\Linak\ FattureInput\0000983_1900001.pdf" ?

    thanks
    Fabio

  4. #4
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    Can I use it also to upload the file into a blob/memo field of a table?

    thanks
    Fabio

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,726
    Yes. Use objectWrite() to extract the memo/blob to a temporary file using tmpfile() first.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,726
    Hi Fabio,

    read my my post again.

    bin:// is the prefix not bin:

    Use base64:// to insert a base64 encoded binary file.

    as I stated in my post, these special prefixes are only expanded when setting com/activex properties.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    Sorry Barry, I do not understand how to use it... I'm a newbie with the Activex.

    I create the Acivex Object:
    loXML = CREATEOBJECT('MSXML2.DomDocument')

    I create the element
    loEncodedPDF = loXML.createElement('EncodedPDF')

    I've try with
    loEncodedPDF.setAttribute('PDF', "base64://C:\Users\Fabio\Documents\Lavoro\CEGEKA\Linak\Fattu reInput\0000156_1900004.pdf")

    loXML.appendChild(loEncodedPDF)


    then:
    strToFile(loXML.xml, "c:\temp\xml.xml")

    or:

    loXML.save("c:\temp\xml2.xml")


    but the content of the file is:
    <EncodedPDF PDF="base64://C:\Users\Fabio\Documents\Lavoro\CEGEKA\Linak\Fattu reInput\0000156_1900004.pdf"/>


    thanks for all your support

    Fabio

  8. #8
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,726
    Once you have figured out what property to set on that activex you donít use setattribute(). I never mentioned using that.

    you just set the property on the activex as you normally would. I.e objname.propname

    I have no idea why you are using strtofile(). The whole point I thought was to be able to store a very long base64 encoded string in the activex and thatís what I have provided for you.
    le()
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  9. #9
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    Bingo!

    Thanks Barry!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us