Problem Note 34573: Images and URL links might be missing from PDF output when using the LASTPAGE inline function
The preproduction inline style function LASTPAGE is available for use in the RTF and PRINTER destinations (PCL/PDF/PS) in SAS® 9.1.3. If the function is used in a TITLE or FOOTNOTE statement in the PRINTER destinations and SAS/GRAPH® is used to generate images, or if the PREIMAGE, POSTIMAGE, or BACKGROUNDIMAGE option is used to include an image in the same file, the image might be missing.
If the function is used in a TITLE or FOOTNOTE statement in the PRINTER destinations and one or more URLs are included as part of a table, the links might not appear.
To circumvent the problem, do one of the following:
- Remove the LASTPAGE function from the code.
- Create ODS RTF output with LASTPAGE in effect, and then use Microsoft Word to save the file in PDF format.
- Create the PDF file twice. Once with a "placeholder" for LASTPAGE, and a second time with a macro variable used in place of the LASTPAGE function. An example of this method is illustrated on the Full Code tab.
Operating System and Release Information
SAS System | Base SAS | Solaris for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
z/OS | 9.2 TS1M0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
The test code below creates two PDF files. The SAS Log is captured from the creation of the first PDF file and is used to determine the number of pages (LASTPAGE), which is stored in a macro variable. The macro variable is then used in a FOOTNOTE statement to mimic the preproduction LASTPAGE inline style function when the final PDF file is created.
/* Start with a clean SAS Log. */
dm "cle log;";
/* Create the PDF file initially to extract the number of pages. */
ods escapechar="^";
filename test "c:\temp\file.log";
/* Direct the SAS Log file to a text file with PROC PRINTTO. */
proc printto log=test new;
run;
ods noresults;
ods pdf file="file.pdf";
/* NN is a placeholder for LASTPAGE */
proc print data=sashelp.cars;
footnote j=r "^{thispage} of NN";
run;
ods pdf close;
ods results;
proc printto;
run;
/* Use the SAS Log file to determine the total number of pages (LASTPAGE) value. */
data _null_ ;
length line $400;
infile test length=lg lrecl=1000 end=eof;
input @1 line $varying400. lg;
if (index(line,"NOTE: ODS PDF printed") > 0) then do;
/* Find the beginning position of the page number */
pos=anydigit(line);
/* Find the ending position of the page number */
pos_pages=indexw(line,'pages');
/* Extract the page number using the SUBSTR function */
newvar=substr(line,pos,pos_pages-pos);
/* Check the page number total */
put "success!" pos= newvar= ;
/* Put the page number total into a macro variable */
call symputx("totpage",newvar);
end;
run ;
%put &totpage;
/* Overwrite the original file (or write the first PDF file to a temporary directory). */
ods pdf file="file.pdf";
/* Put the total page number back into the original footnote (or title) */
proc print data=sashelp.cars;
footnote j=r "^{thispage} of &totpage";
run;
ods pdf close;
Images and URL links might not appear in PDF output created by ODS if the preproduction inline function LASTPAGE is used in a TITLE or FOOTNOTE statement.
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2011-09-09 12:01:20 |
Date Created: | 2009-01-23 09:47:44 |