Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extract PDF from XML
Message
 
To
16/11/2022 07:54:02
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01685345
Message ID:
01685350
Views:
47
Hi,

this is very old code for base64 decode.
FUNCTION DECSTR64
PARAMETERS S
    LOCAL i,j,j,k,q,ch,s2,buf,tmpc
    tmpc = 0
    j = 0
    buf = 0
    s2 = ''
    k = LEN(s)
    FOR i = 1 TO k
        ch = ASC(SUBSTR(s,i,1))
        q = IIF((ch >= 97 AND ch <=122),25+ch-96,IIF((ch >= 65 AND ch <=90),ch-65,;
            IIF((ch >= 48 AND ch <=57),ch+4,IIF(ch = 47,63,IIF(ch=43,62,-1)))))
        IF q < 0 THEN
            RETURN IIF(ch = 61,s2,'')
        ENDIF
        buf = BITOR(BITLSHIFT(buf,6),q)
        j = j + 6
        IF j >= 8 THEN
            j = j - 8
            tmpc = CHR(BITAND(BITRSHIFT(buf,j),255))
            buf = BITAND(buf,BITLSHIFT(1,j) -1)
            s2 = s2 + tmpc
        ENDIF
    ENDFOR
    RETURN s2
ENDFUNC
MartinaJ

>Yes, but limited number of parameters. I think STRTOFILE is enough (or not?).
>
>Not sure if STRCONV() function exists in VFP6.
>
>
>>I know that :-) but how to convert to PDF file (base 64 encoded)? Simply STRTOFILE or something else?
>>
>>Hi,
>>
>> Because you don't write more...
>>
>>LOCAL m.lcData, m.liES, m.liEE, m.lcES, m.lcEE
>>m.lcES="<pdfstart>"
>>m.lcEE="</pdfstart>"
>>
>>m.lcData=FILETOSTR("any.xml")
>>m.liES=AT(m.lcES, m.lcData)
>>m.liEE=AT(m.lcEE, m.lcData)
>>
>>m.lcPDFDATA=SUBSTR(m.lcData, m.liES+LEN(m.lcES), m.liEE-m.liSE-LEN(m.lcES)-1)
>>
>>?m.lcPDFDATA && data can be encode base64 or hex 
>>
>>
>>MartinaJ
>>
>>>How can I extract PDF file which is integrated in XML as a attachment tag? (Note VFP6)
>>>
>>>Thanks in advance.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform