BookmarkSubscribeRSS Feed
ckx
Quartz | Level 8 ckx
Quartz | Level 8

I'm getting a strange error opening a PDF file: An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem. The PDF is indeed incomplete from a certain point on.

 

The SAS program that created the PDF ran without errors, warnings or other issues. The RTF version of the output is complete with no issues. It's just the PDF.

 

I've narrowed the issue down to the use of "dagger" and "double dagger" symbols. If I leave these out, the PDF prints correctly. The daggers are programmed using (*ESC*){unicode 2020} which is appended to a label. Nothing unusual there. And the daggers show up normally in the table 5 or 6 times, then suddenly there's an error.

 

I've tried to reproduce this problem in a simple example but daggers usually print just fine in PDF output. But I'm curious if others have encountered something similar, where ODS PDF output is created without error but an error occurs when opening the PDF.

6 REPLIES 6
ckx
Quartz | Level 8 ckx
Quartz | Level 8

Yes, I can open the PDF in de Edge browser. The file is complete except for one missing dagger, which is the point where the text is missing if I use Acrobat Reader.

 

One difference between the PDF and the RTF is that the PDF uses "fancy" daggers, apparently using Times New Roman as font. The RTF uses plain Arial. Both files were created using the Journal font. The PDF has Times New Roman and CumberlandAMT as embedded fonts.

 

I tried using Pearl as ODS style. I still got an error but at an earlier point. I'm using SAS 9.4M3 by the way. The problem also occurs on SAS 9.4M4 on our test server

RW9
Diamond | Level 26 RW9
Diamond | Level 26

This may not be the most helpful response, but I always create RTF files, then convert them to PDF from there, rather than using the PDF destination.  Just never had any fun with SAS->PDF directly, and the bookmarks and such like are such a pain.

ckx
Quartz | Level 8 ckx
Quartz | Level 8

Well, PDF output is mandatory at our company, since it's less easy to tamper with. And PDF output usually works just fine, unless graphs are involved. Both SAS/Graph and ODS Graphics are sometimes mangled in the PDF output whereas they look fine in the RTF. What I'm curious about is whether others also have problems with PDFs containing just plain tables.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

PDF is mandatory at my place also, not just plain, but including bookmarks title pages etc.  I still go from SAS to RTF, then from RTF to PDF.  SAS->PDF is just a massive pain.

ckx
Quartz | Level 8 ckx
Quartz | Level 8

Together with a colleague, I've been able to narrow down the cause of this problem. It seems to occur when a unicode symbol is on the border of a table cell. In the following example, the dagger symbol is not printed for cell widths 1.0 and 1.1 cm.

 

/*
Output created using ODS PDF produced errors when opened in Acrobat Reader
This problem appears to be due to a unicode symbol being on the border
of a table cell. The program below creates tables with different
cell widths. Errors occur at 1.0 and 1.1 cm
*/
%let _progdir=; /* Fill in the pathname to this program */
%let _progname=Test_dagger;

options nodate nonumber nocenter;

ods escapechar='^';
%put &=sysvlong4;
%put &=sysencoding;

data test;
	length dagger $100;
	dagger='Test (*ESC*){unicode 2020}';
run;

*-- create a PDF with a double dagger a sevaral cell widths;
%macro test (width  /* width in cm */ );

	ods _all_ close;
	ods pdf file="&_progdir.\&_progname.&width..pdf" style=Journal;
	title2 h=8pt 'Table 1 Descriptive statistics comparing history, body composition, ' 'clinical outcomes and dietary outcomes, by treatment group (ITT)';
	title3 "Cellwidth = &width. cm";
	footnote1 h=8pt '^{unicode 2020} P-value based on a two-sample t-test';
	footnote2 h=8pt '^{unicode 2021} P-value based on a Mann-Whitney test';
	footnote3 h=8pt '* P-value based on a Fisher''s exact test';

	proc report data = test;
		column dagger;
		define dagger / style = [cellwidth = &width. cm];
	run;

	ods _all_ close;
%mend;


%test (0.900);
%test (0.950);
%test (0.990);
%test (1.000);
%test (1.100);
%test (1.200);

Under certain circumstances, the PDF shows an error message when opened in Acrobat Reader. If the program was run in an UTF-8 session in batch mode using the company autoexec.sas, then the PDF produced an error message. But if I copied the system options, etc. to the program and ran it without the autoexec.sas, the PDF could be opened normally, although the dagger symbols are not present at widths 1.0 and 1.1cm. No errors either in the PDF file if a Wlatin1 session was used, although the original problem did occur in a Wlatin1 session.

 

I'm using SAS 9.4M3 with Enterprise Guide 7.13. Batch mode is run using a VBScript. I've submitted this problem to SAS Netherlands as a problem of disappearing symbols, where it can also happen that a PDF file produces an error message

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2056 views
  • 1 like
  • 3 in conversation