Merge PDF-Files
stiasta
Member Posts: 106
Hello!
I was wondering if anyone had an example of how to merge pdf-files that are created by using SAVEASPDF function?
I have tried this.
I have also tried using BioPDF:
Any tips?
I was wondering if anyone had an example of how to merge pdf-files that are created by using SAVEASPDF function?
I have tried this.
Filenames[1] := 'C:\Temp\1.pdf';
Filenames[2] := 'C:\Temp\2.pdf';
Filenames[3] := 'C:\Temp\3.pdf';
SalesInvoiceReport.SAVEASPDF(Filenames[1]);
DyconTimerReport.SAVEASPDF(Filenames[2]);
DyconUtgiftReport.SAVEASPDF(Filenames[3]);
IF ISCLEAR(DyconPDFMerger) THEN
CREATE(DyconPDFMerger);
tempText := DyconPDFMerger.MergeFiles('C:\Temp\output.pdf', 'C:\Temp\', '1.pdf;2.pdf;3.pdf');
(The code above forces the role based client to disconnect.)I have also tried using BioPDF:
IF ISCLEAR(BioPDF) THEN
CREATE(BioPDF);
BioPDF.Init;
BioPDF.LoadSettings;
RunOnceFile := BioPDF.GetSettingsFileName(TRUE);
BioPDF.SetValue('Output','c:\temp\testoutput.pdf');
BioPDF.SetValue('Showsettings', 'never');
BioPDF.SetValue('ShowPDF', 'no');
BioPDF.SetValue('ShowProgress', 'no');
BioPDF.SetValue('ShowProgressFinished', 'no');
BioPDF.SetValue('SuppressErrors', 'yes');
BioPDF.SetValue('ConfirmOverwrite', 'no');
BioPDF.SetValue('MergeFile', Filenames[1] + '|' + Filenames[2] + '|' + Filenames[3]);
BioPDF.WriteSettings(TRUE);
TimeOut := 0;
WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
SLEEP(1000);
TimeOut := TimeOut + 1;
END;
Any tips?
0
Comments
-
some questions:
1. where did you put the code?
2. does it work in classic?
2a. if so, is the a biopdf (or whatever) installed in the same place of nav server? (you know, automations are instatiated on nav server, unless you specify TRUE parameter of the CREATE function) unless you specify the TRUE parameter as the third one. To check this out, try to do// wrong code deleted
CREATE(biopdf,FALSE,TRUE);
instead ofCREATE(biopdf);
0 -
-
yup, sorry...i forgot the second parameter :whistle:mihail_kolev wrote:...did you mean...
i edited my previous message...0 -
Hello again!
I have tried what you said. Good suggestion.
But, the merged pdf will still not write and save. I have checked the server and the client and it is not in either of the places.
I have tried to start the automation on both computers aswell. (create(bla, false, false), and create(bla, false, true).
Here is all of the code i am tryingFilenames[1] := 'C:\Temp\1.pdf'; Filenames[2] := 'C:\Temp\2.pdf'; Filenames[3] := 'C:\Temp\3.pdf'; SalesInvoiceReport.SAVEASPDF(Filenames[1]); DyconTimerReport.SAVEASPDF(Filenames[2]); DyconUtgiftReport.SAVEASPDF(Filenames[3]); //IF ISCLEAR(DyconPDFMerger) THEN //CREATE(DyconPDFMerger); //tempText := DyconPDFMerger.MergeFiles('C:\Temp\output.pdf', 'C:\Temp\', '1.pdf;2.pdf;3.pdf'); {CREATE(wShExec); wShExec.Run('c:\PdfDocuments\DyconPDFMergerCMD.exe ' +'c:\temp\output.pdf'+' '+ Filenames[1] + ' ' + Filenames[2] + ' ' + Filenames[3]); CLEAR(wShExec); //SHELL('c:\PdfDocuments\DyconPDFMergerCMD.exe', Filenames[1], Filenames[2], Filenames[3]); } IF ISCLEAR(BioPDF) THEN CREATE(BioPDF, FALSE, TRUE); BioPDF.Init; BioPDF.LoadSettings; RunOnceFile := BioPDF.GetSettingsFileName(TRUE); BioPDF.SetValue('Output','c:\temp\testoutput.pdf'); BioPDF.SetValue('Showsettings', 'never'); BioPDF.SetValue('ShowPDF', 'no'); BioPDF.SetValue('ShowProgress', 'no'); BioPDF.SetValue('ShowProgressFinished', 'no'); BioPDF.SetValue('SuppressErrors', 'yes'); BioPDF.SetValue('ConfirmOverwrite', 'no'); BioPDF.SetValue('MergeFile', Filenames[1] + '|' + Filenames[2] + '|' + Filenames[3]); BioPDF.WriteSettings(TRUE); TimeOut := 0; WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN SLEEP(1000); TimeOut := TimeOut + 1; END;0 -
There has not been written to the Nav Server in C:\Temp The only file i get outputted is c:\temp\1.pdf which is the first report. I have tested by creating two more pdfs called 2.pdf and 3.pdf to see if the problem was that there was only 1 file. But no, it will still not merge into testoutput.pdf.0
-
SAVEASPDF help online:
my WAG is that you create the pdfs on the server and then try to merge them on the client (where they does not exist) :-kThe FileName parameter specifies a location on the computer running Microsoft Dynamics NAV Server
you should DOWNLOAD the pdfs from nav server and then merge them
OR
install the biopdf on the server and instantiate it on the server (a plain CREATE(biopdf) should be enough). In this way you can save the 3 pdfs to merge on server, merge them on the server and then download the result on the client (this is the best option in my opinion: in this way you install the biopdf only on the server machine instead of on all the clients; moreover you thin the network traffic)0 -
The BioPDF is installed on the server and the automation create command is set to CREATE(BioPDF, FALSE, FALSE)
But still nothing.0 -
I did also try a plain create(BioPDF)0
-
summary:
1. triple SAVEASPDF (create files on server) --> how many files does it create? just one of three?!
2. create(biopdf) on server
3. merge files on server on specified path on the server (does the path exist?)
4. the merged pdf is NOT created on the server (or is just one file created or whatever?)
if you've done everything correct, i think that there's some issue in the automation management, but here i can't help: never used it0 -
1. This is irrelevant since it does not have anything with the Pdf merging. I have commented these out and created 3 static files in the filepath c:\Temp that is inserted into bioPDF
2. done
3. Path does exist
4. The merge is not created on the server.
So i think this problem lies with the BioPDF automation server... I am not sure that it runs at all, when there is no report that is printing.0 -
ok, you can try to run the biopdf manually on the three files and see what happens: if it works, check out the management of the automation :-k or search online "biopdf navision" or something similar (but i think you've already done both these things)0
-
stiasta wrote:
... IF ISCLEAR(DyconPDFMerger) THEN CREATE(DyconPDFMerger); tempText := DyconPDFMerger.MergeFiles('C:\Temp\output.pdf', 'C:\Temp\', '1.pdf;2.pdf;3.pdf'); ...
did you try the DyconPDFMerger again with correct CREATE parameters... IF ISCLEAR(DyconPDFMerger) THEN CREATE(DyconPDFMerger,FALSE,ISSERVICETIER); tempText := DyconPDFMerger.MergeFiles('C:\Temp\output.pdf', 'C:\Temp\', '1.pdf;2.pdf;3.pdf'); ...
I've never merged pdfs and never heard about these pdf mergers... Just shoot in the dark
-Mihail- [MCTS]0 -
The DyconPDFMerger is not installed on the client machine. Install it and try again.-Mihail- [MCTS]0
-
It is installed.
I am running the role based client from the same machine as the server now.
I can try running it from a seperate computer.... trying it now0 -
ok, this error (first one) is thrown by CREATE and for some reason it can not create the DyconPDFMerger.Main - are you sure you should use the .Main class?-Mihail- [MCTS]0
-
Its the only class
I made the automation server myself. but i have a seperate topic relating to that
0 -
did you try to release the automation for x86 platform. NAS and RTC are x86-Mihail- [MCTS]0
-
worked! :O
I had already tried the x86 but without restarting nav server and without the ISSERVICETIER command.0 -
stiasta wrote:worked! :O
I had already tried the x86 but without restarting nav server and without the ISSERVICETIER command.
Great
, Just add the [SOLVED] check to your first post
-Mihail- [MCTS]0 -
Thank you so much for your help mihail_kolev and Belias. As a reward you can have my pdfmerger if you want
:) send me a PM to ask about it and i will send it to you.
The problem with BioPDF is still a little annoying. But, no need to do anything about it now.0 -
stiasta wrote:Thank you so much for your help mihail_kolev and Belias. As a reward you can have my pdfmerger if you want
:) send me a PM to ask about it and i will send it to you.
The problem with BioPDF is still a little annoying. But, no need to do anything about it now.
You've shared the pdf merger already - viewtopic.php?f=32&t=47806 , but that's why we are here - sharing knowledge and help each other
-Mihail- [MCTS]0 -
you can say it twice!that's why we are here - sharing knowledge and help each other
our reward is that you (or someone else in the forum) will spend a pair of minutes of their time in order to help us with our problems!
0 -
Another problem occurred...
I am able to run the Automation server from the server itself. BUT, when i try it from a client outside the server it will not work. I think it is the reoccurring problem of setting permissions for windows 2008 server :S
any idea?0 -
It will work, but you need to install the automation on client machines. PDF files will be saved on the service machine, so the filename should look like "\\service_machine\C$\temp", not "C:\temp". And the folder should be shared-Mihail- [MCTS]0
-
as me and mihail said, the saveaspdf function saves the 3 pdfs on the server. If you instantiate the automation on the client machine it won't see the files. BTW i think that if you instantiate it on the server, i think it will see the files w/o problems. Otherwise use the path said by mihail or use DOWNLOAD instruction to copy the files on the client (but as i said before, i would prefer the "do everything on server and then download the merged file" solution, if it works.0
-
looks like some other libraries are not installed. Is the .NET version on the client up to date?-Mihail- [MCTS]0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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