I'm doing a developmnet that needs to download a base64 PDF codified from a webService. I call correctly to the WS, and its answer is this one. As you can see. in the node "v1:strEtiquetas" I get the label codified in Base64:
My idea is to save that value in a blob field (sticker) of one of my tables:
For testing that I'm getting all the data correctly, my nex step is to save the PDF in my computer:
But the generated PDF is in blanck, 0kb, empty...
Does anyone see where can I be making any fail?
THnak you very much
Try to use TempBlob Record and function FromBase64String to get the file.
Thnaks for your answer,
As you can see in the 2nd image if uploaded, I'm already using the "FromBase64String" function. The "sticker" field from shipment is a blob type field.
What is the difference that are you talking about?
Thank you again.
Sorry I think you're using AL, and that's the way to convert base 64 from files received.
I made a extensión a couple of months ago, and I decode a base 64 file from web Service without problems.
Can you show us the variable definitions?
Yes, I'm using AL.
Which variable definitions are you asking for?
Type DotNet System.Array.'mscorlib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089'
MemoryStream DotNet System.IO.MemoryStream.'mscorlib, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ASk for anything you need
So I think you're still coding in development enviroment (C/AL), cause in extension development DotNet isn't allow (only for on-premises extensión)
Add the following Italic line to your code and try again:
ShipHeader.Sticker.CREATEOUTSTREAM(OStream);MemoryStream.WriteTo(OStream);ShipHeader.Registered := TRUE;
Thank you very much, it worked! Really appreciated!
Another question with this issue. My intention is to print the received PDF in a printer. Now, what I'm dping is to download it with this code:
But as you will know, this is saveing the PDF into a temp folder, that dissapears when the NAV session is closed. Does exist any way to download it to a folder indicated by me? Or may be, without saving the PDF phisically, to print it directly using the saved blob?
Thank you very much
The DOWNLOADFROMSTREAM function allow you to save the file in a folder in the client side, so you can modify the '<TEMP>' directory for the path you want to save the file.
I think it's better to save the file to a network location for share the file with other users.
Hope this help
What I've tried is to use
//DOWNLOADFROMSTREAM(IStream,'','<TEMP>','',ToFile); //descarga silenciosa
DOWNLOADFROMSTREAM(IStream,'','C:\XML','',ToFile); //descarga silenciosa
But instead os saving in the indicated path, it opens the dialog window for saving or opening the PDF file
The only way to not get de dialog it's to use the Magic Path (<TEMP>), If you want to save to a specific folder, dialog box always be prompted.