ArcherPoint Dynamics NAV Developer Digest - vol 166
The NAV community, including the ArcherPoint technical staff, is made up of developers, project managers, and consultants who are constantly communicating, with the common goal of sharing helpful information with one another to help customers be more successful.
As they run into issues and questions, find the answers, and make new discoveries, they post them on blogs, forums, social media…so everyone can benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this community—so we thought, wouldn’t it be great to share this great information with everyone who might not have the time to check out the multitude of resources out there? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from NAV experts and devotees around the world. We hope these insights will benefit you, too.
Appending a Document to a Printed Purchase Order in Dynamics NAV
Kyle: I have a customer that needs a large extra page of Terms and Conditions to be appended to a printed Purchase Order. This extra page is an entire page of 6-point font legalese. I currently have that stored as a PDF in a BLOB, and then right after the report prints, I have the system print the PDF. This works fine for printing, but not so well for attaching to an email since you wind up with two separate files.
I can’t figure out a way to inject a PDF into a SAVEASPDF report.
So I am thinking of switching the PO report layout to Word, converting the Terms and Conditions from PDF to Word (so the BLOB is now a Word document), and then using DotNet Microsoft Word calls to combine the two and generate a single file.
Thoughts? Commentary? Personal insults?
Michael: Does the PDF have to appear with a particular format, or is it just raw text that could be read from a table and appended as an extra data item on an extra page of the report?
Kyle: It has to appear in a particular format. Parts are bolded, parts are italicized. And it is enough text that even if I could ignore the formatting, I’d have to make it BIGTEXT and somehow parse out each line and hope it wraps correctly.
Suresh: One way is to store the file in the specified format in a specific location as PDF, so that it is easy to modify the file if needed and then use the merge tool to merge the PO report PDF with that file. See this thread on adding another page on a PDF file.
Bill: If you paired the Blob Text Set and Get functions with an HTML Placeholder on the report, that might get you what you need, see Waldo’s entry on HTML on Reports.
Not sure about an HTML text editor to edit the text in NAV, but I’ve seen various add-in controls over the years. At worst, you could cut/paste the HTML out of a WYSIWYG editor.
Tom: I did something like this for a client some time ago, but I didn’t have to deal with special formatting like bold/italic fonts. I did it by putting all the terms/conditions in a table, and then looping through the table and putting the text on a line. There was also a “Line Break” Boolean that let the invoice report know that it needed to break before a line. But with special formatting, you might just have to make it an image and then print that.
Kyle: I managed to get the two documents combined into one using DotNet and Word, but Word’s PDF converter isn’t 100% accurate, so it mangles the layout a bit.
I am going to have to cave and turn this into an image.
How about you, NAV developers? Have you run into this need? How did you deliver your solution?
Stay abreast of what is new in the Microsoft Dynamics NAV community and at ArcherPoint by subscribing to our monthly newsletter, Better Business, by completing the form in our Resource Center.
If you are interested in NAV development, be sure to see our collection of NAV Development Blogs.
Read more “How To” blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV.