Print BLOB file to Printer

Angelo
Member Posts: 180
Hi All,
1. Is blob field only for 1 file?
2. Is it possible to get blob data (pdf file, image file, text file, etc) and print it to default printer without open the file ?
If No 2 = Yes then please let me know the pseudocode.
1. Is blob field only for 1 file?
2. Is it possible to get blob data (pdf file, image file, text file, etc) and print it to default printer without open the file ?
If No 2 = Yes then please let me know the pseudocode.
0
Comments
-
You can store anything in a BLOB field, including multiple files - it's basically a bucket full of bits.
You will however need to create logarithms to store and retrieve your data from the BLOB field. To NAV, it's just a series of bits and bytes.
It's basically the same answer to your second question: you cannot just send a random quantity of bits and bytes to your printer and expect it to make sense of it. That leaves you with two options: opening the file using a dedicated program (e.g. Word) or building your own Word-decoder...
I would strongly advise against the latterBrian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
Hi Rocatis,
Based on your recommendation, it's very complicated if we put many files in one blob field.
In Navision standard, I can see that one field is only for 1 file otherwise system will prompt confirmation to ask user to replace existing file in blob field in case user want to import file again.
and also Navision standard will show the file and never find function to print the file directly to printer (like post + print function)
for example, if blob file is word doc, there is function to open blob file and Microsoft word will open to show blob file.
for many files, I will follow navision standard (1 blob = 1 field). it's easier to manage.
but for printing, Is there anybody has done customization sending blob file (eg. pdf, word, txt, etc) to printer for printing without opening the file?0 -
Angelo wrote:Is there anybody has done customization sending blob file (eg. pdf, word, txt, etc) to printer for printing without opening the file?Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
Thanks Rocatis
I will try to use the third party program (classexec)
Regards,
Angelo0 -
I put an image to the blob field.
When i want to print this image on report ;
1. Call CALCFIELDS(Rec."Blob Field Name"); OnPreReport
2. Put a picture box to report and set Source property Rec."Blob Field Name"
You can see the image on report0 -
Hi sarpherviz,
my blob field is PDF file. I dont think can use your method.0 -
Export BLOB to temporary file and call predefined application to print it.0
-
-
YourRecord.CALCFIELDS(YourBLOB); TempBLOB.BLOB := YourRecord.YourBLOB; TempServerFileName := C419.ServerTempFileName('.pdf'); C419.BLOBExportToServerFile(TempBLOB, TempServerFileName); //if you need it on client PC TempClientFileName := C419.DownloadTempFile(TempServerFileName);
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Slawek_Guzek wrote: »
YourRecord.CALCFIELDS(YourBLOB); TempBLOB.BLOB := YourRecord.YourBLOB; TempServerFileName := C419.ServerTempFileName('.pdf'); C419.BLOBExportToServerFile(TempBLOB, TempServerFileName); //if you need it on client PC TempClientFileName := C419.DownloadTempFile(TempServerFileName);
THank you @Slawek_Guzek . I'm doing this:lShipment.CALCFIELDS(Sticker); lTmpBLob.Blob := lShipment.Sticker; lTempServerFileName := lFileManagement.ServerTempFileName('C:\XML\sticker.pdf'); lFileManagement.BLOBExportToServerFile(lTmpBLob,lTempServerFileName); lTempClientFileName := lFileManagement.DownloadTempFile(lTempServerFileName);
BUt I get the "invalid path" error. What am I doing wrong?0 -
Change this line:
lTempServerFileName := lFileManagement.ServerTempFileName('C:\XML\sticker.pdf');
to that:lTempServerFileName := lFileManagement.ServerTempFileName('pdf');
0 -
The line:
lTempServerFileName := lFileManagement.ServerTempFileName('C:\XML\sticker.pdf');
has to be:lTempServerFileName := lFileManagement.ServerTempFileName('.pdf')
as in posted exampleSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
THnak you both, but..Where does this save my PDF file?
lShipment.CALCFIELDS(Sticker); lTmpBLob.Blob := lShipment.Sticker; lTempServerFileName := lFileManagement.ServerTempFileName('.pdf'); lFileManagement.BLOBExportToServerFile(lTmpBLob,lTempServerFileName); lTempClientFileName := lFileManagement.DownloadTempFile(lTempServerFileName);
edit:
I've seen that it saves in the temporaru folder again, and with a name like "__TEMP__05b8e5886d1f4332b3c150d892dbd699.tmp.pdf". My idea is to save it in a known folder to get it later for printing0 -
In this case change this line:
lTempClientFileName := lFileManagement.DownloadTempFile(lTempServerFileName);
to that;lFileManagement.DownloadToFile(lTempServerFileName, ClientFileName);
To a ClientFileName you choose.1 -
Thank you very much, it worked like this:
lShipment.CALCFIELDS(Sticker); lTmpBLob.Blob := lShipment.Sticker; lTempServerFileName := lFileManagement.ServerTempFileName('.pdf'); lFileManagement.BLOBExportToServerFile(lTmpBLob,lTempServerFileName); lFileManagement.DownloadToFile(lTempServerFileName, 'c:\XML\pegatina.pdf');
Thank you all for your tips!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions