Include a PDF-file in a XML-file

sanoj
Member Posts: 19
Hi,
I want to include a pdf-document in a XML-file (base64-coded ?). Is there a way to do that in NAV?
Br,
Jonas
I want to include a pdf-document in a XML-file (base64-coded ?). Is there a way to do that in NAV?
Br,
Jonas
0
Comments
-
Save PDF convert base64 to BigString and then export has an XMLport.0
-
Thanks for the reply, but how do I do that?
How do I convert to base64?
How do I include the base64 data in the xmldocument?
As a note: I should send this data via MSMQ to a web server.
Br,
Jonas0 -
In Codeunit EP Format Functions you have a sample to convert to Base64
Convert Base64 to BigText and export it to XML.0 -
One small note on MSMQ - especially if you are planning on embedding files & PDFs in your XML. There are some size limits to the Messages that you can place in the Queue. It depends on how you're encoding the data (Unicode characters take up double the space) but I think there's a 4 or 8mb limit.
You should check the documentation of MSMQ in MSDN. I have yet to ever hit this limit when simply sending transactional data between systems through MSMQ, but if you're going to be PDF'ing reports to send...they can get big quickly (depending on how many pages in the report & how complicated the data).0 -
Thanks both of you for your reply.
I tried the following code:CREATE(xmldoc2); xmldoc2.loadXML('<root/>'); xmlNode2 := xmldoc2.documentElement; CREATE(Picture); xmlNode := Picture.GetPictureAsBase64('C:\file.pdf', 100, 'VALUE'); NewChildNode := xmlNode2.ownerDocument.createNode('element', 'VALUE', ''); NewChildNode.text := xmlNode.text; xmlNode2.appendChild(NewChildNode); xmldoc2.save('c:\xmlfile.xml');
Xmlfile.xml contains a VALUE element, but it is empty.
What am I doing wrong?0 -
Just taking a quick look at your code and some of my old code here is my suggestions.
NewNode := XMLDoc2.createElement('VALUE'); NewValue := XMLDoc2.createTextNode(<data string>); NewNode.appendChild(NewValue); XMLDoc2.appendChild(NewNode);
0 -
I tried you code and replaced <data string> with xmlnode.text returned from Picture.GetPictureAsBase64. But still empty...
I think the problem has to do with Picture.GetPictureAsBase64...0 -
Have you tried the code sample with just plain text to make sure that it lays it down correctly in the XML file?
Have you checked that your GetPictureAsBase64 actually returns a useable text string? Maybe just printing the first few characters to a confirm prompt?
One other thing to check with some of these string/streams/file IO operations is to move the pointer back to the beginning of the data (I think thats more for File IO & in .Net...but maybe something to check)0 -
yes, confirm the return value of GetPictureAsBase640
-
GetPictureAsBase64.HasErrors is true and when I look into Event Viewer I got an error saying:
Error during image processing:Parameter is not valid.
Are you sure GetPictureAsBase64 can handle all types of files, not just images?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