Save Custom Word Report layout as PDF - Skips next page

LaurenzDolly
Member Posts: 1
Hi All,
I have a question about my custom Word report Layout.
Since I have a customer that wants to make use of the NAV Custom Word layout, I created some nice content with nesting repeaters.
So I created a dataset that has loops within loops (loopieloopie).
When my repeater on the page, hits the next page when viewing my result report everything goes well in Word.
But when I try to print the report as a PDF (CTRL+SHIFT + P), the PDF skips my next page.
It seems that it's trying to post everything on 1 page.
When saving the Word-file as PDF or send the report to a PDF-printer (Bullzip) the PDF is created as it should be.
Only when saving as PDF directly from the requestpage it goes wrong.
I am using NAV 2017

I have a question about my custom Word report Layout.
Since I have a customer that wants to make use of the NAV Custom Word layout, I created some nice content with nesting repeaters.
So I created a dataset that has loops within loops (loopieloopie).
When my repeater on the page, hits the next page when viewing my result report everything goes well in Word.
But when I try to print the report as a PDF (CTRL+SHIFT + P), the PDF skips my next page.
It seems that it's trying to post everything on 1 page.
When saving the Word-file as PDF or send the report to a PDF-printer (Bullzip) the PDF is created as it should be.
Only when saving as PDF directly from the requestpage it goes wrong.
I am using NAV 2017

0
Answers
-
As far as I know for PDF creation of Wordlayout reports, a serverbased AddIn is used (which is based upon Aspose.Words in NAV 2016). Does the same effect occur with NAV 2016? It might be helpful, if you could show the correct printout for comparison. May be there is some issue with the page height setting or the page boundaries.New kits on the blog: https://massivedynamicsblog.wordpress.com0
-
This looks more or less like a problem in the Aspose.Words component that is being used to convert the rendered document to PDF. Is it possible to get a sample docx file without any customer data that I can use for testing the problem and possibly file a support case at Aspose? Sometimes it helps we upgrade the Aspose component to the latest version.
_________________
Niels-Henrik Sejthen
Senior Software Developer
Microsoft Dynamics NAV
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.0 -
As a workaround you may try a clientside conversion to pdf via Word (MS Word needs to be installed on the client computer). Here is a small code snipet, which should replace the code in function ConvertToPdf in Codeunit 9651 and should work with NAV 2017, too:
IF NOT GetWordApplication(WordApplication) OR ISNULL(WordApplication) THEN
ERROR('Microsoft Word is necessary for conversion to PDF format.');
FileName := FileMgt.ClientTempFileName('docx');
FileName := FileMgt.BLOBExport(TempBlob,FileName,FALSE);
FileNamePDF := FileMgt.ClientTempFileName('pdf');
WordDocument := WordHelper.CallOpen(WordApplication,FileName,FALSE,FALSE);
WordHelper.CallSaveAsPdf(WordDocument,FileNamePDF);
WordHelper.CallClose(WordDocument,FALSE);
WordHelper.CallQuit(WordApplication,FALSE);
IF DeleteClientFile(FileName) THEN;
ServerFileName := FileMgt.UploadFileSilent(FileNamePDF);
FileMgt.BLOBImportFromServerFile(TempBlob,ServerFileName);
IF DeleteClientFile(FileNamePDF) THEN;
IF DeleteServerFile(ServerFileName) THEN;
DeleteServerFile is a custom TryFunction implemented like DeleteClientFile and essentially calls
FileMgt.DeleteServerFile. Furthermore some new local variables have to be defined:
Be sure to make the three Word-DotNet variables RunOnClient=Yes.
This code is also useful for Wordlayout+ when a PDF output is needed.
(see https://massivedynamicsblog.wordpress.com/2016/09/15/wordlayout/ )
New kits on the blog: https://massivedynamicsblog.wordpress.com0
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