08-10-2013 09:23 AM
During multiple file processing (many thanks to nice paper by Kevin McGowan and Matt Reich)
SAS reads 8 '.txt' files and produces 8 '.pdf' files to the same directory.
How to write 8 '.pdf' files into one with correct pagination?
I name the '.pdf' files in a 'DDMMMYY-HH-MM-SS-mS' fashion according to the first basic approach
described in the paper with the
ODS PDF FILE = "&my_folder.\%sysfunc(translate(%sysfunc(datetime(),datetime20.3),--,.)&MyExtt"
statement. I tried to use the following:
ODS PDF FILE = "&my_folder.\PDF_FILES_COMBINED&MyExtt"
but the ERROR alike '.../PDF_FILES_COMBINED.pdf doesn't exist' appears.
How to solve the task ?
08-10-2013 01:43 PM
Every PDF file, whether made by SAS or made by some other method has specific "open" and "close" syntax. So the issue is that once SAS creates a separate PDF file, you cannot use SAS to combine the separate PDF files. You would need an Adobe product or some 3rd party PDF "combiner" app to do that, post processing.
So the challenge is this...you have this now, where I assume that your macro program is reading multiple TXT files and creating a unique ODS "sandwich" for each TXT file (like this, without the fancy names):
ods pdf file='file1.pdf';
ods pdf file close;
ods pdf file='file2.pdf';
ods pdf close;
And, instead, what you need to do is this -- go ahead and read all 8 TXT files, but change your ODS PDF invocation, so that all 8 proc prints or proc "whatevers" are inside just 1 ODS PDF sandwich:
ods pdf file='allfiles.pdf';
ods pdf close;
You cannot (easily) combine the separate PDF files afte SAS creates them. I have heard of folks making PostScript files, then reading the PostScript file with a program and then stripping out the "open/close" syntax and then making a PDF by writing all the "stripped" files back out, but it is a HUGE effort and far easier to alter your ODS "sandwich" or to get an Adobe product to do the combining after the fact.
08-10-2013 02:14 PM
Instead of putting out PDF immediate you could use SAS(R) 9.4 Output Delivery System: User's Guide (Proc Document)
First saving it in a SAS environment and than creating the output what you want
01-02-2014 01:48 AM
"So the issue is that once SAS creates a separate PDF file, you cannot use SAS to combine the separate PDF files. You would need an Adobe product or some 3rd party PDF "combiner" app to do that, post PDF processing." Is this true? I thought I can do the basic PDF document processing works within SAS without using Aodobe products. A little disappointing.
01-02-2014 01:33 PM
You can absolutely make 1 PDF file from multiple SAS procedures like this:
ODS PDF file="all_3_procedures.pdf";
** procedure 1;
** procedure 2;
** procedure 3;
ODS PDF CLOSE;
But this was not the original question as I understood it. In the original question, the original poster said that 8 txt files had been converted to 8 separate PDF files and that the new requirement was to combine the 8 separate PDF files into 1 "new" PDF file. This is different than the "sandwich" code I showed above. So when you said "I thought I can do the basic PDF document processing works within SAS without using Adobe products." The "basic" processing is what I showed above...a single ODS PDF "sandwich" that captures your procedure or multiple procedure output to create 1 PDF file. This is the basic processing. More advanced processing is to save your procedure output in an ODS DOCUMENT store and then rearrange and/or replay that output from ODS DOCUMENT format to PDF output using ODS DOCUMENT/PROC DOCUMENT. This is also possible.
If you have multiple, already existing PDF files....whether created by SAS or not, let's call them myfile1.pdf, myfile2.pdf and myfile3.pdf, then that is not "basic" ODS processing. As far as I know, Adobe has specific "start of file" and "end of file" information embedded in each PDF file when it is created. So, the only way to combine them into a single "new" PDF file is to use an Adobe product or a 3rd party software program that combines existing PDF files.
02-23-2014 10:33 PM
After or before multiple pdf pages processing, you can combine multiple pdf documents, like you said, 8 pdf files, or even more into one new pdf document by using a pdf merger, that is to say, you only need to implement a pdf document merging tool add-on, then you can integrate this pdf merger into your visual basic or c sharp application to merge multiple pdf files into one. And I am a programmer using visual basic a lot, so, I would like to share my codes on pdf merging to you, you are allowed to copy and make some modification of them.
Public Sub CombineDocumentsToStream(s As Stream, docList As List(Of BaseDocument))
Tag: pdf processing, documents combining
02-24-2014 12:00 AM
Try to use Nitro PDF professional software for any operation with pdf (combining, deleting pages, spliting, editing....).
Any help related to Nitro, please let me know.
Uma Shanker Saini